Hello everyone, the GoFrame framework has officially released version v2.6.0 today!👏👏👏👏
This release mainly involves a lot of code improvements and BugFix work. Due to the numerous changes in this version, the following is a Chinese introduction to some of the more important improvements. For a detailed ChangeLog, please refer to (especially for BugFix): https://github.com/gogf/gf/releases/tag/v2.6.0
Complete code changes: https://github.com/gogf/gf/compare/v2.5.0...v2.6.0
Thanks to all the contributing developers in this release:

Feature Improvements
The minimum required Golang version for the framework has been upgraded from v1.15 to v1.18.
g- Added the
g.Gomethod to conveniently create asynchronousgoroutineswithctxandrecoverparameters.
- Added the
glog- Improved the
Handlercallback processing function'sHandlerInputinput parameters by addingValuesparameter, which is the input parameter list for log printing: Logging - Handler - Added a general method
HandlerStructureto print log content with structured parameters: Logging - Handler - Improved the log file
rotatelogic to solve the problem of failing torotatefiles in certain scenarios.
- Improved the
gerror- Added error stack mode (
brief/detail): Inbriefmode, the error stack will only print non-framework component stacks. Indetailmode, the error stack will print the complete framework code call chain. The framework usesbriefmode by default: Error Handling - Other Features
- Added error stack mode (
gcode- Added
gcode.CodeInternalPanicerror code, and allpanicerrors captured by framework components will return with this error code.
- Added
gmap- Added
Diffmethod for comparing and returning the differences between twoMapobjects.
- Added
gaes- Added
PKCS7Padding/PKCS7UnPaddingmethods.
- Added
gdb- Removed
ConvertDataForRecordconversion method, addedConvertValueForFieldconversion method. - Modified the
CheckLocalTypeForFieldmethod, changing the return parameter type fromstringtoLocalType. - These are mainly used for database implementations and usually in community components. If a user has local implementations for the
gdb.DBinterface, they should be aware of this change. - Added
Model.Partitionmethod, allowing users to explicitly specify partition parameters during database operations. - Added
Model.LeftJoinOnFields/RightJoinOnFields/InnerJoinOnFieldsmethods, making it easier to implementJoinoperations. - Fixed the implementation issue of the
Model.WherePrefixNotInmethod.
- Removed
gredis- Added
Clusterconfiguration option to specify whether to use cluster mode: Redis - Configuration - Added
Protocolconfiguration option to specify theRESPversion: Redis - Configuration
- Added
gi18n- Improved translation file reading logic, supporting automatic file reading from resource managers: I18N - Configuration
gclient- Added
NoUrlEncodefeature, allowingGETrequests to not automatically performUrlEncodeon parameters.
- Added
ghttp- Improved exit signal handling to support graceful exit upon capture of exit signals on the Windows platform.
goai- Supports automatic recognition of
ghttp.UploadFiletype asOpenAPIv3Filetype. - Removed redundant description information from
Pathobjects andMethodobjects. - Converts the example field type of the interface into the corresponding data type based on the parameter data type.
- Supports automatic recognition of
gcfg- Added
AdapterContentconfiguration interface implementation, allowing configuration management through specific configuration content: Configuration - AdapterContent
- Added
gctx- Added
NeverDonemethod, which wraps a givenctxobject and returns actxobject that never expires or isCancelled.
- Added
gfile- Changed the default file creation mode from
0777to0755. - Improved
Copy/CopyFile/CopyDirmethods, addedCopyOptionoptional parameter to control the copy logic options.
- Changed the default file creation mode from
gmutex- Improved
gmutex.Mutexobject usingGolang's new version ofmutex, directly utilizing theTryLock/TryRLockfrom the new version standard library. The methodsLockFunc/TryLockFuncare retained. - Added
gmutex.RWMutexobject, extending the standard library'ssync.RWMutexobject, with new methodsLockFunc/TryLockFunc, RLockFunc/TryRLockFunc.
- Improved
gstr- Added
List2/ListAndTrim2/List3/ListAndTrim3methods, similar to thePHP listfunctionality, which splits a string and returns it as multiple result values. - Added
CaseConvertmethod to perform string naming format conversion according to a givenCaseTypetype parameter.
- Added
gconv- Added
ConvertWithRefermethod, which uses the given parameter as a type reference and converts the given parameter to the specified type.
- Added
gutil- Added
FillStructWithDefaultmethod, which automatically fills the given struct object/pointer with default values by reading thestruct tag.
- Added
gvalid- Fixed the issue with
enumsvalidation rule not supportingmapparameter types.
- Fixed the issue with
Community Components
Configuration Management
- Added
contrib/config/consulcomponent, implementedconsulservice for configuration management component interface: https://github.com/gogf/gf/tree/master/contrib/config/consul
Database Implementation
- Improved
contrib/drivers/dmcomponent: - Supports
schemaparameter configuration. - Supports
time.Time/*time.Timetime type parameter operations. - Improved
contrib/drivers/sqlitecomponent to supportInsert IgnoreandSaveoperations. - Added
contrib/drivers/sqlitecgocomponent, supportingi386system architecture throughcgo. - Improved
contrib/nosql/rediscomponent: - Added
TLSConfigconfiguration to supportTLSconnection toRedis Server. - Added
Protocolconfiguration option to support the latest version ofRedis Server.
Service Registration Discovery
- Added
contrib/registry/nacoscomponent, implementing microservice registration and discovery usingnacos: https://github.com/gogf/gf/tree/master/contrib/registry/nacos - Improved
contrib/registry/filecomponent to automatically delete expired registrations, preventing clients from discovering and connecting to expired server addresses. - Fixed some implementation issues in the
contrib/registry/polariscomponent.
Microservice Components
- Improved
contrib/rpc/grpcxcomponent: - Clients support directly providing connection addresses to access the server.
- Enhanced unit tests to improve code quality.
Development Tools
- Improved the installation method of the
clitool to additionally supportgo installinstallation:go install github.com/gogf/gf/cmd/gf/v2@latest - Improved
gf runcommand by addingWatchPaths/-wconfiguration, allowing specified path list monitoring to avoid thetoo many opened filesissue caused by monitoring all files in local projects by default: Auto Compiling - Improved
gf gen ctrlcommand by addingMerge/-moption to control the generation of controller code files according to theapilayer rather than splitting them into different files based onapiinterfaces: Controller Generating - Improved
gf gen daocommand by addingRemoveFieldPrefix/-rfoption to automatically remove the prefix of generated table field names: Dao/Do/Entity Generating - Improved
gf gen pbentitycommand by addingRemoveFieldPrefix/-rfoption to automatically remove the prefix of generated table field names: DB Table To Protobuf - Improved
gf gen servicecommand to automatically generate method comments for objects in thelogicmodule into theserviceinterface file. - Improved
gf version/gf -vcommand for more detailed tool version, runtime environment, and framework information. - Improved the initialization efficiency of development tools, removing
initpackage method logic that affected initialization efficiency. - Fixed the issue of
Linkdatabase configuration failure in thegf gen daocommand. - Other detailed fixes.