Hello everyone, the GoFrame
framework has officially released version v2.4.0
today! 👏👏👏👏
The biggest highlight of this version is the provision of features for microservices development, development tools, and project scaffolding, along with comprehensive microservices development documentation!! The design of microservices components continues to focus primarily on interface design to ensure good flexibility and extensibility. The interfaces are maintained in the main repository of the framework, while specific interface implementations are pragmatic and provided within community components.
In fact, the feature functionality of this version has long been Ready
, but due to the significant workload of documentation, it took about a month to complete it relatively thoroughly, thus adjusting the release date of the version accordingly. We believe that documentation is as important as code and is an integral part of a milestone release. We know how to use it well and hope to tell everyone how to use it well, to more pragmatically help more developers. This is one reason why GoFrame
framework documentation has been able to accumulate abundantly over time. Furthermore, complete source code comments are primarily in English to assist overseas users. The official website documentation remains predominantly in Chinese to support major development teams in the Greater China region.
Come and check out what we've updated! Enjoy!
🍺🍺🍺🍺🍺🍺🍺🍺
Full code changes: v2.3.0...v2.4.0, thanks to all the contributing developers for this release:
New Features
Official release of microservices development features and addition of a complete microservices development section on the official website: Microservice Development
Functional Improvements
Database Component
gdb
- Fixed the issue of automatic table structure query failure during cross-database operations: https://github.com/gogf/gf/issues/2338
- Fixed the
Namespace
configuration issue not taking effect underpgsql
. - Fixed the issue of being unable to open
sqlite
database files when using the new unified configuration: https://github.com/gogf/gf/issues/2435 - Improved underlying database operation return logic, returning underlying errors through
gerror.Wrap
to ensure that the upper layer can obtain underlying custom error objects. - Fixed the issue of unsigned integer fields being converted to signed integer types when querying data tables: https://github.com/gogf/gf/issues/2356
- Fixed parsing issue of multi-level
Model
being used as subquery parameters during subqueries: https://github.com/gogf/gf/issues/2339 - Improved time maintenance feature, enabling the writing of full time (granularity down to nanoseconds) for write/update/delete operations.
- Fixed unlimited execution issue under soft delete scenarios when given an empty
Where
condition: https://github.com/gogf/gf/issues/2427 gredis
- Fixed configuration handling and object initialization issues when creating objects.
Container Component
garray
- Added
Filter
method for customizing traversal and filtering of array elements. - Added
RemoveValues
method to support batch deletion of elements by parameter value. - Improved
InsertBefore
method to support batch parameter insertion capability. gmap
- Added
IsSubOf
method to determine if the currentmap
is a subset of the specifiedmap
. gqueue
- Fixed
Len/Size
length calculation issue: https://github.com/gogf/gf/issues/2509 - Fixed concurrent safety issue with
Close
method: https://github.com/gogf/gf/issues/2015
Network Component
gclient
- Added
SetDiscovery
andSetBuilder
methods to allow callers to customize client service discovery and load balancing interface implementations. ghttp
- Improved support for reading specified parameters from
Header/Cookie
when receiving parameters, supporting the specification of readingHeader/Cookie
in the route'sin
tag (in:header/cookie
). - Improved
ResponseWriter
to implement thehttp.Flusher
interface, simplifying the user'sStream
output development logic: Response - Streaming - Improved link tracing implementation logic to prevent issues from being ignored when an error occurs in reading submitted content internally.
- Improved parameter reading logic to prevent
r.GetRequestMap()
from returning content that includesform-data
formbody
information: https://github.com/gogf/gf/issues/2261 - Improved internal context reception logic:
- Original logic: Removed ignoring of the underlying
Request
ctx
and created a newctx
supporting link tracing. - Latest logic: Inherits the
ctx
object of the underlyingRequest
and extends thisctx
to support link tracing features.
- Original logic: Removed ignoring of the underlying
- Improved graceful shutdown logic to allow customizing the timeout of graceful shutdown.
- Improved configuration feature to allow developers to configure custom service registration interface implementation objects.
System Component
gcmd
- Improved
AddObject
method to allow directly adding specified*Command
or standardizedObject
objects as subcommands. gctx
- Fixed missing
TraceID
issue inGetInitCtx
method: Context gfile
- Improved
Temp
method to align basic logic implementation with standard libraryos.TempDir
, avoiding temporary directory conflict issues during single-machine collaboration. gtimer
- Added
Quick
option when creating timers to trigger the specified callback method upon adding timers.
Utility Component
gconv
- Fixed
Scan
method conversion failure issue in certain scenarios when fields are integer/floating point arrays: https://github.com/gogf/gf/issues/2391 - Fixed issue of
Interfaces
method directly returning[]
when attribute is 0: https://github.com/gogf/gf/issues/2395 - Fixed conversion issue when
json tag
is,omitempty
without variable name. - Fixed conversion failure issue when target type is a pointer to a custom basic type.
- Fixed conversion failure issue of
gvar.Var
type to common third-party packagedecimal.Decimal
type: https://github.com/gogf/gf/issues/2584 - Improved
Struct
method to resolve conversion failure issue when field type istime.Time/*time.Time
and provided conversion value is a non-standard library-supported string like2022-12-15 16:11:34
: https://github.com/gogf/gf/issues/2371 gtag
- Added
SetGlobalEnums/GetEnumsByType
methods for automatedGolang Enums
management. Requiresgf gen enums
command to work. gutil
- Fixed null pointer error issue in
Dump
method under certain scenarios: https://github.com/gogf/gf/issues/2487 gvalid
- Added
Field
field in custom validation method parameters to address field missing issues in custom validation error prompts: https://github.com/gogf/gf/issues/2499
Community Component
Database Driver
- Improved
dm/mysql
component to resolveQueryEscape
issue when special characters (e.g.,/
) exist in timezone configuration.
NoSQL Adapter
- Fixed missing connection pool configuration parameters in
redis
component configuration.
Service Registration Discovery
- Added
file
registration discovery component for file-based service registration discovery locally, typically used for single-node testing. - Improved implementation details of
etcd/polaris/zookeeper
and refined single test cases.
Microservice Scaffolding
- Added
grpcx
microservice component for microservice development using thegrpc
communication protocol: Microservice Development
Development Tools
- Added
gf gen pb
command for compilingproto
files to generatego pb
files: Protobuf Compilation - Added
gf gen pbentity
command for automatically generatingproto
data structure definition files for database tables: DB Table To Protobuf - Added
gf gen enums
command for parsing specified directorygo
files and automatically generatingenums
data files based on enumeration definition specifications, mainly used forOpenAPI
interface documentation display (experimental feature): Enums Maintenance - Improved
gf up
command by adding toolCLI
automatic upgrade feature. - Improved
gf gen service
command to stop auto-generating methods into the interface definition file after the method's comment. - Improved
gf build
command by addingDumpENV
option to control whether to print environment information used during compilation, with default setting off. - Improved
gf docker
command by addingTag
option to ensure compatibility with older versions.