Main Content
GoFrame v2.10 brings a significant number of important features and optimizations, with the most notable being comprehensive generic support for container components, greatly enhancing type safety and development experience. This release also introduces automatic configuration binding and watching mechanisms, RSA encryption and SHA256 hash support, database connection pool optimization, type conversion enhancements, and more. Additionally, development tools have been improved in multiple areas, including more flexible table name wildcard matching and more comprehensive unit test coverage. These new features and improvements will significantly enhance the framework's usability, performance, and development efficiency.
The following are the main contents of this version. For detailed Change Log, please refer to:
https://github.com/gogf/gf/releases/tag/v2.10.0
For complete code changes, please refer to: https://github.com/gogf/gf/compare/v2.9.0...v2.10.0
Special Thanks
💖💖💖 Thanks to all developers who contributed to this version 💖💖💖
Compatibility Notes
-
All
containercomponents now fully support generics. In addition to new generic types, existing container types have been migrated to type-safe generic implementations. -
The
util/gpagepagination component has been marked as deprecated. It is recommended to use theORMpagination feature or implement pagination logic yourself.
Component Improvements
-
container/garray -
container/gmap -
container/gset -
container/glist- Added generic
List[T], providing type-safe doubly linked list operations. - Improved unit tests and example code. #4483
- Added generic
-
container/gqueue -
container/gring- Added generic
Ring[T], providing type-safe ring buffer operations. #4496
- Added generic
-
container/gpool- Added generic
Pool[T], providing type-safe object pool operations. #4493
- Added generic
-
container/gtree -
container -
database/gdb- Added
MaxIdleConnTimeconfiguration option to support setting the maximum lifetime of idle connections in the connection pool, optimizing connection pool management. #4625 - Added
lock update skip lockedsupport, providing more flexible row locking mechanisms. #4607 - Added table field metadata setting feature; when generating
dao, table field registration code can be automatically generated for convenient field management and validation. #4460 - Added ability to retrieve all configurations, facilitating validation and other business operations. #4389
- Optimized
SoftTimesoft delete time feature, improving usability. #4559 - Optimized performance when grouping fields, improving query efficiency. #4440
- Fixed issue where raw
SQL CountignoresWhereconditions. #4611 - Fixed
panichandling inDoCommitto prevent blocking when database driver panics. #4423 - Fixed cache error overwrite issue caused by using fixed cache keys in pagination queries. #4339
- Fixed
iTableNameinterface detection issue when executingScanonreflect.Valueobjects usingWithAll. #4606 - Fixed field filtering issue in
FieldsPrefixwhen table name/alias is unknown. #4602 - Fixed column name ambiguity in
GROUP BY/ORDER BYforMySQL JOIN. #4521 - Fixed incorrect
schemain database output logs when using database sharding feature. #4319 - Fixed
GetArrayreturn type and addedBoolsmethod. #4452 - Simplified
orderandgroup byalias reference logic, improving code readability. #4555 - Added quotes to
FieldsPrefixto ensure field name correctness. #4485 - Supported multiple
orderfields inwith.
- Added
-
net/ghttp- Enhanced
GetHeadermethod to support setting default values, simplifying code logic. #4210 - Improved
GetMetaTagmethod to handleniland type checking, enhancing robustness. - Fixed form field value truncation issue when uploading files. #4627
- Fixed route custom parameter recognition anomaly. #4549
- Fixed issue where
@is added in binding handler pattern whenServer Domainis an empty string. #4100, #4101 - Fixed
queryparameterin-tagparameter parsing error. #4227, #4228 - Fixed attachment filename support for
utf8encoding. #4459 - Fixed related issues. #4567, #4569
- Enhanced
-
util/gconv- Added
OmitEmptyandOmitNiloptions forScanfunction, providing more flexible type conversion control. #4584 - Fixed incompatibility issue when converting from old implementation to
nilpointer targets, ensuring backward compatibility. #4224 - Fixed data loss issue when converting nested
mapinMapToMap. #4612 - Fixed unsafe
stringtobytesconversion. #4600 - Fixed scanning functionality for deep
slicetypes.
- Added
-
os/gcfg- Added
Loaderfeature, supporting automatic struct binding and configuration watching, similar to Spring Boot's@ConfigurationPropertiesannotation, greatly simplifying configuration management. #4575 - Added file watcher support with custom callbacks, providing more flexible configuration change handling. #4446
- Restored default behavior where configuration files take precedence over environment variables and command-line parameters, maintaining consistency with older versions. #4647
- Fixed ignoring
fsnotifyevent errors to avoid complete failure ofgcfgpackage. #4400
- Added
-
os/gfile -
os/gtime -
os/gcache- Optimized default cache lazy initialization, reducing unnecessary resource occupation. #4468
-
os/gcron- Fixed occasional unit test failures in
gcronpackage, improving test stability. #4419
- Fixed occasional unit test failures in
-
encoding/gjson -
net/gclient -
net/goai -
util/gvalid -
util/gutil -
crypto/grsa- Added
RSAencryption and decryption functionality, providing completeRSAencryption support, including public key encryption, private key decryption, and other operations. #4571
- Added
-
crypto/gsha256- Added
gsha256component, providingSHA256hash calculation functionality. #4558
- Added
-
errors/gerror -
database/gredis- Supported retrieving raw
Redisclient, providing lower-level operation capabilities. #4306
- Supported retrieving raw
-
util/gpage- Marked as deprecated. It is recommended to use the
ORMpagination feature or implement it yourself. #4230
- Marked as deprecated. It is recommended to use the
Community Components
-
contrib/registry/nacos -
contrib/drivers/pgsql- Added support for more field type conversions, enhancing
PostgreSQLcompatibility. #3737 - Added support for converting array types
numeric[]anddecimal[]to Go[]float64, improving array type handling. #4457, #4511 - Fixed field overlap issue with same table names in
pgsqlmulti-schema mode. #4375 - Fixed merging of duplicate fields, especially key constraints. #4465
- Added support for more field type conversions, enhancing
-
contrib/drivers/gaussdb- Added
gaussdbdriver support, expanding database support range. #4563
- Added
-
contrib/drivers/dm -
contrib/drivers/mysql -
contrib/drivers/mssql -
contrib/drivers/oracle- Added
Replace/LastInsertIdfunctionality support fordm/pgsql/mssql/oracle, completing database features. #4547
- Added
-
contrib/clickhouse -
contrib/config/apollo- Fixed issue where
gcfg config apollocannot retrieve multiple namespace configurations andwatch apollo changecausing configuration loss. #4509
- Fixed issue where
Development Tools
-
gf run -
gf init -
gf gen ctrl -
gf gen dao- Added wildcard pattern support for
tablesconfiguration, providing more flexible table name matching capabilities. #4632 - Added broad matching support for
tableExattribute. #4453 - Improved command implementation with
removeFieldPrefixoption support for more flexible field name prefix handling. #4243 - Improved
typeMapcheck logic. #4410 - Fixed overlapping
shardingPatternmatching issue, ensuring correct sharding configuration. #4631 - Fixed potential duplication issues during generation. #4268
- Fixed issue with generating sharding
daoin multipleshardingPatterntables. #4379 - Fixed table
exmatching bug fix. #4458 - Fixed performance issue where command execution becomes very slow. #4498
- Fixed
unknown time zoneerror when generating code forclickhouseonwindowsplatform. #4368
- Added wildcard pattern support for
-
gf gen service -
gf gen enums- Fixed incorrect output path when using relative paths. #4636
-
gf build- Fixed
gf build --dumpEnvcommand error. #4635
- Fixed
-
gf env- Fixed command error. #4635
-
Test Improvements