Hello everyone, the v2.1 release includes some business-related function features, improvements, and bug fixes. It's recommended to upgrade.
Video Introduction: 2022-06-22 GoFrame v2.1 Features & Q&A
New Features
- The development tool introduces the
gen servicecommand, supporting automated generation ofserviceinterface code and implementation injection based on thelogiclayer code: Service Generating - Database Features:
- Added
WhereBuilderfeature for more flexibleSQLcondition statement combinations: Model Query - Where - Added
Hookfeature for custom hook event handling: ORM Model - Hook - The framework adds a
DeepCopyfeature for deep copying of types: - Added
gutil.Copymethod for deep copying specified content. - Generic types add a
Copymethod for deep copying their own content. - Some data types of the framework now support the deep copy feature, such as basic container types like
gvar, garray, gmap.
Major Improvements
Community Components
ORM Driver Implementation
- Added
drivers/clickhousefor hookingclickhouseto thegoframe ORMcomponent. - Complete unit tests for
clickhouse/mssql/pgsql/sqlite/oraclecomponents. - Moved the
mysqldriver from the main library to the community module to facilitate decoupling from the main library. Therefore, from subsequent versions, developers need to manually import driver dependencies: https://github.com/gogf/gf/tree/master/contrib/drivers
Registration Discovery Implementation
- Added
polarisNorth Star service registration interface implementation: https://github.com/gogf/gf/tree/master/contrib/registry/polaris - Improved the
etcdservice registration discovery interface implementation component: https://github.com/gogf/gf/tree/master/contrib/registry/etcd
Registration Discovery
- Improved the
Serviceimplementation object to an interface definition and provided a defaultServiceimplementation for improved extensibility and usability. - Improved
HTTP/GRPC Client&Serverinterface implementations.
Load Balancing
- Improved the
Nodeinterface definition and added theNodesinterface definition. - Fixed the load balancing issue under the
HTTP Client.
Network Components
gclient- Improved service discovery implementation logic.
- Fixed client shutdown error causing connection pool reuse issues.
ghttp- Improved
Request.GetUrlmethod details forURL Schema. - Parameter reception supports automatic receipt of
UploadFileattributes. - Added custom UI guidance documentation for interface documentation: API Document - Custom UI
- Changed the default external
JS CDNdependency for interface documentation tounpkg.com. - Improved service registration implementation logic.
- Improved internal detail implementation logic.
- Fixed the parameter empty judgment issue.
goai- Improved adherence to the
OpenAPIV3protocol implementation. - Supports all custom tags starting with
x-, automatically adding them to theOpenAPIV3results. - The component moved from the
protocolcategory to thenetcategory, changing theimportpath.
System Components
gcfg- The default file system interface implements support for the
propertyfile format. gcmd- Parameter parsing adds
CaseSensitiveconfiguration, default parsing is case-insensitive, especially affecting structured parameter reception: Command - Structure - Added cross-process link tracking feature: Command - Tracing
glog- Added a global
Handlersetting function, allowing developers to globally customize handling of all logs of theglogcomponent, such as globally outputting in theJSONfile format: Logging - Handler - Added the default
JSONformatHandlerfor developers to use: Logging - Handler gsession- Resolved excessive memory usage issues caused by too many user accesses.
gproc- Added cross-process link tracking feature: Process - Tracing
Container Components
garray- Improved the
Uniquemethod performance, addedDeepCopyinterface implementation. glist- Added
DeepCopyinterface implementation. gmap- Added
DeepCopyinterface implementation. gset- Added
DeepCopyinterface implementation. gtype- Added
DeepCopyinterface implementation. gvar- Added
Copymethod for deep copying the current generic object. - Added
DeepCopyinterface implementation.
Database Components
gdb- Added
WhereBuilderfeature for more flexibleSQLcondition statement combinations: Model Query - Where - Added
HOOKfeature for custom hook event handling: ORM Model - Hook - Improved the logic of data conversion processing before submitting to the underlying
driver. - Moved the
mysqldriver from the main library to the community module to facilitate decoupling from the main library. Therefore, from subsequent versions, developers need to manually import driver dependencies: https://github.com/gogf/gf/tree/master/contrib/drivers
Encoding Components
gproperty- Added
gpropertycomponent for parsingJava Propertyformat files. gjson- Added support for encoding, decoding, and manipulating
propertyfile format data: General Codec - Fixed the issue of precision loss when reading large integers.
Text Processing
gstr- Improved
WordWrapmethod to be more friendly withUnicode, especially Chinese line breaks. - Fixed the issue where
RepliceIignoring case string replacement in certain scenarios.
Error Handling
gerror- Added
Unwrapmethod (same asNextmethod) to support the newGolangversionUnwraperror interface. - Added
Equalmethod for comparing whether two errors are equal: Error Handling - Comparison - Added
Ismethod to support the newGolangversionIserror interface: Error Handling - Comparison
Utility Methods
gconv- Removed support for octal strings when converting integers.
- Improved internal implementation logic for readability and maintainability.
gutil- Added
gutil.Copymethod for deep copying specified content. - Improved
gutil.Dumpmethod.
Development Tools
Compared to the stable code components of the main library, CLI development tools have some incompatible updates in recent versions. Please pay attention to release records during upgrades; details are available in the source code adjustments.
- Improved
buildcommand, supporting specifying the generation directory ofpackcode files, with some parameter adjustments. - Improved
dockercommand, supporting multipledocker tagrenaming and automatic repository pushing. - Improved
gen daocommand, supporting customdao/do/entitycode generation directory, no longer forced to generate in theservice/internaldirectory: Dao/Do/Entity Generating - Added
gen servicecommand, supporting automated generation ofserviceinterface code based onlogiclayer code: Service Generating - Fixed issues with the
runcommand's custom program startup parameters,gofmt/goimportsprogram path containing spaces.
Incompatibilities
- Moved the
mysqldriver from the main library to the community module to facilitate decoupling from the main library. Therefore, from subsequent versions, developers need to manually import driver dependencies: https://github.com/gogf/gf/tree/master/contrib/drivers - The
ghttp.Response.WriteJson/Xmlmethods no longer returnerror. Adjust according to the compilation error. - The
goaicomponent moved from theprotocolcategory to thenetcategory, changing theimportpath. Adjust according to the compilation error. - Database
ORMoperations withgtime.Timetype parameters will automatically convert them totime.Timetype before submission to the underlying databasedriverto solve the precision loss issue. This means thatgtime.Timetype parameters are also affected by the database configuration's timezone parameters. For details, see: ORM - Timezone