We are pleased to announce the official release of GoFrame
version v2.8.0
! This update brings significant improvements and new features, enhancing GoFrame
in terms of development efficiency, execution performance, stability, and extensibility.
Version Highlights
Compatibility Update
GoFrame v2.8.0
requires a minimumGolang
version of1.20
to provide more efficient performance and stability.- The
container/gring
component has been deprecated, and thecontrib/trace/jaeger
component has been removed from the source code repository, simplifying dependency management.
Component Improvements
- The
database/gdb
module now supportscreated_at/updated_at/deleted_at
integer timestamp fields,unix socket
connections,time/year
field types, and introduces theModel.Exist
method, significantly improving the flexibility and efficiency of database operations. - The
util/gconv
component leverages type caching to enhance conversion performance, with conversion performance for complex data types improved by approximately300%
. - The
net/ghttp
andnet/gudp
network service components have optimized parameter configurations and request processing logic, providing a more streamlined development experience.
- The
Development Tools Upgrade
- The
gf init
command supports generating a multi-application project structure within a single repository. - Optimizations to commands like
gf gen ctrl
,gf gen dao
, andgf run
, further enhance code generation flexibility and execution efficiency, simplifying project setup processes.
- The
Community Component Support
- Added support for the latest features in multiple community drivers such as
contrib/drivers/mssql
andcontrib/registry/etcd
, improving integration with external services.
- Added support for the latest features in multiple community drivers such as
Future Outlook
The GoFrame
team thanks all community users for their support. We will continue to listen to community feedback to provide users with richer features and more efficient development support.
Special Thanks
💖💖💖 Thanks to all the contributing developers for this release 💖💖💖
Main Content
This release contains numerous changes. Below are the major updates in this version; for a detailed Change Log
, please refer to: https://github.com/gogf/gf/releases/tag/v2.8.0
For comprehensive code changes, please refer to: https://github.com/gogf/gf/compare/v2.7.0…v2.8.0
Compatibility Notice
- The minimum
Golang
version requirement has been adjusted from1.18
to1.20
. - The
container/gring
component is marked as deprecated and will no longer be maintained. - The
contrib/trace/jaeger
component has been removed from the source code repository. - The parameter of
Load*
methods in theencoding/gjson
component has been adjusted frominterface{}
to[]byte
to improve performance. - The port parameter of the
StartPProfServer
method in thenet/ghttp
component has been changed fromport int
toaddress string
for increased flexibility. - The
net/gudp
component has been refactored, with individual method parameter adjustments: UDP
Component Improvements
database/gdb
- Time maintenance features have been enhanced to support integer fields. When
created_at/updated_at/deleted_at
are integer fields, they will be updated with timestamps. For details, see: ORM Model - Time Fields - Added the
Model.Exist
method to determine if data that meets given conditions exists: Model Query - Exist - Added support for
time/year
field types in the database: ORM Senior - Type Recognition - Added the
OrderRandomFunction
interface method, implemented and supported theOrderRandom
sorting method for common databases. - Improved the
Model.Fields
method to supportgdb.Raw
type parameters: ORM Model - Fields Retrieval - Enhanced the
With
feature inorm
tags to supportunscoped
: Model Association - With - Added support for
unix socket
local database service connections in the configuration file. - Removed
sql
statements from trace information to reduce the size of thetrace
package. - Improved performance of query result conversion to
struct
.
- Time maintenance features have been enhanced to support integer fields. When
net/ghttp
- Removed
XxxReq/XxxRes
naming restrictions for input and output objects in route registrations. - Adjusted the port parameter of
StartPProfServer
fromport int
toaddress string
for increased flexibility. - Removed request/response data from trace information to reduce the size of the
trace
package. - Fixed graceful shutdown issues with the
/debug/admin/shutdown
interface.
- Removed
net/goai
- Allowed specifying parameter types in request/response structure attributes using the
type
tag.
- Allowed specifying parameter types in request/response structure attributes using the
container/gtree
- Refactored
gtree
implementation using the third-party data structure componentgithub.com/emirpasic/gods
to enhance extensibility and maintainability.
- Refactored
encoding/gjson
- Adjusted
Load*
method parameters frominterface{}
to[]byte
to improve performance.
- Adjusted
os/gcron
- Added
StopGracefully
method to allow waiting for currently executing scheduled tasks to complete before stopping: Cron Job - Usage
- Added
os/gfsnotify
- Improved file recursive monitoring implementation so that when a directory is being monitored, newly created subdirectories within it, or their subdirectories, will also be recursively monitored: File Watching
test/gtest
- Improved
AssertIN/AssertNI
assertion methods by adding support for substring containment assertions.
- Improved
util/gvalid
- Added
required-if-all
validation rule, where a parameter is mandatory if all specified parameters and their values are equal: Data Validation - Rules - Enhanced
phone
validation rule by adding support for171
series phone numbers.
- Added
util/gconv
- Enhanced conversion performance with type caching, improving conversion performance for complex data types by approximately
300%
.
- Enhanced conversion performance with type caching, improving conversion performance for complex data types by approximately
Community Components
drivers/mssql
- Changed the base
driver
fromgithub.com/denisenkom/go-mssqldb
to the official componentgithub.com/microsoft/go-mssqldb
.
- Changed the base
contrib/drivers/pgsql
- Added support for
InsertIgnore
operations. - Added support for operations from
Golang
array types to database array field types.
- Added support for
contrib/registry/etcd
- Added
DialTimeout
andAutoSyncInterval
configuration options.
- Added
contrib/registry/nacos
- Replaced the dependency on
github.com/joy999/nacos-sdk-go
with the official componentgithub.com/nacos-group/nacos-sdk-go/v2
.
- Replaced the dependency on
contrib/rpc/grpcx
- Removed request/response data from trace information to reduce the size of the
trace
package. - Since the
grpc
component has enabled thegrpc.Dial
method,grpc.NewClient
is now used to replacegrpc.Dial
.
- Removed request/response data from trace information to reduce the size of the
contrib/sdk/httpclient
- Added
Handler
interface to allow users to customize the handling ofHTTP Client
return data.
- Added
Development Tools
Improved the
gf init
command by adding the-a/monoApp
option for creating new application project templates in a large repository: Project ScaffoldEnhanced the
gf pack
command by adding support for command parameter options from a configuration file, with the configuration path asgfcli.pack
.Enhanced the
gf tpl
command by adding support for command parameter options from a configuration file, with the configuration path asgfcli.tpl.parse
.Improved the
gf gen ctrl
command by re-implementing parsing logic usingAST
, increasing the accuracy of generatedGo
code file content, and enhancing the extensibility of the feature.Improved the
gf run
command:- Added support for command parameter options from a configuration file, with the configuration path as
gfcli.run
. - Automatically deletes temporary old process binary files when a new process replaces the old one at the end of a temporary subprocess.
- Added support for command parameter options from a configuration file, with the configuration path as
Improved the
gf gen dao
command:- Added
field mapping
feature to support specifying field configurations for generatedGolang
data types: Dao/Do/Entity Generating - Automatically identifies integer fields with a length of
1
, such asbit(1)/tinyint(1)/int(1)
, asbool
typeGolang
data types. - Automatically reads the directory name of generated code files as the package name for generating
dao/do/entity
files. - Due to database restrictions, the
cli
has removed default support for thedm
database. If needed, please manually modify the source code to installcli
. - Fixed the issue where the
link
parameter becomes invalid when both thelink
parameter and configuration file exist simultaneously.
- Added