Hello everyone, the GoFrame
framework has officially released version v2.7.0
today! 👏👏👏👏👏👏👏👏👏
The highlight of this version is the provision of the metric
monitoring component. The main library offers an interface-based metric
design, and the community component provides an OpenTelemetry
-based metric
interface implementation. This feature is disabled by default and only enabled by default when specific interface implementations or community implementations are introduced. The current version also provides implementations for monitoring metrics of HTTP Client&Server
, and metrics for other components will be provided in subsequent versions. For details, please refer to the documentation: Service Metrics.
Additionally, this version implements support for the Save
operation for dm/mssql/oracle/pgsql/sqlite
databases, thanks to community member https://github.com/oldme-git 💖.
Moreover, it is worth mentioning that in this version, we have added an ignore symbol #
for the second-level field of the gcron
scheduled task component, used to convert the 6
-segment cron pattern into a 5
-segment Linux crontab pattern, addressing the issue of task execution inaccuracy due to delay at the second-level granularity: Cron Job - Expressions.
Due to the numerous changes in this version, below is an introduction to some important improvements in Chinese. For the detailed ChangeLog
, please refer to: https://github.com/gogf/gf/releases/tag/v2.7.0.
For the complete code changes, please refer to: https://github.com/gogf/gf/compare/v2.6.0...v2.7.0.
Thanks to all the contributors who participated in this version 💖!
Component Improvements
gdb
- Added
Stats
interface definition and implementation for obtaining connection pool information maintained by the current databaseorm
object: ORM Senior - Connection Pool - Added
FormatUpsert
interface definition and implementation, used for writing/updating operations for different database types, i.e.,Save
operation. - Added
SqlType
type, changing the existingsql type
type definition fromstring
toSqlType
type. - Added
Model.OnConflict
method for implementing update policy when field unique key conflicts for some database types, particularly forSave
operation. - Fixed the issue where the
ClearTableFieldsAll
method was not effective.
- Added
ghttp
- Added
MiddlewareNeverDoneCtx
middleware, which developers can choose to use to avoid issues related tocontext cancel
on the server side when clients cancel requests: FAQ - Added monitoring metric implementation for
http server
, which is disabled by default and does not affect performance, unless themetrics
feature is enabled: HTTPServer - Metrics - Improved
tracing
records, changing thespan
name fromquery uri
toroute uri
for easier aggregation when viewing. - Changed the type of
EnterTime
andLeaveTime
properties in theRequest
object fromint64
to*gtime.Time
. - Marked the
WebSocket
method as deprecated, it will be removed in future major versions, along with the removal ofhttp server's
built-in coupling support forwebsocket
. It is recommended to use other open-sourcewebsocket
components withhttp server
for more decoupled flexibility in the future. - Fixed a memory issue caused by large file uploads due to the
Request Body
being readable multiple times by default. - Fixed the issue where the
pattern
parameter of theStartPProfServer
method was ineffective. - Added the
Access-Control-Expose-Headers Header
return to theRequest.ServeFileDownload
method to supportajax
file requests. - Added
SwaggerUITemplate
configuration option to the service configuration for quickly configuring theHTML
content of theSwaggerUI
page. - The
http server
no longer prints built-in middleware when starting route printing.
- Added
gclient
- Fixed the issue that forced all
http
requests to go through service discovery domain name resolution when service discovery is enabled. - Added monitoring metric implementation for
http client
, which is disabled by default and does not affect performance, unless themetrics
feature is enabled: HTTPClient - Metrics
- Fixed the issue that forced all
gcron
- Added an ignore symbol
#
, using it as a placeholder for the second-level field in thecron pattern
, indicating the ignore of the second-level field, converting a6
-segmentcron pattern
to a5
-segmentlinux crontab pattern
: Cron Job - Expressions - Fixed an issue where specified second-level tasks (for example
2 * * * * *
) might execute twice if there is inaccurate time at the underlying level.
- Added an ignore symbol
gerror
- Fixed an issue with the recursive logic being ineffective in the
gerror.HasCode
method.
- Fixed an issue with the recursive logic being ineffective in the
g
- Improved the
DumpJson
method for printing any variables inJSON
format.
- Improved the
gcache
- Fixed an issue caused by excessive
goroutine
due to the creation of a large number ofCache
objects.
- Fixed an issue caused by excessive
gcmd
- Added
RunWithSpecificArgs
method, used to run command objects with customarguments
. - Fixed the issue of parameter loss due to conflicts between parameter struct names and struct tag names in some scenarios.
- Added
gfsnotify
- Fixed a
panic
issue that might occur when thegfsnotify
object is closed.
- Fixed a
glog
- Fixed the redundant
rotate
issue of.gz
suffix log compressed files related to therotate
feature.
- Fixed the redundant
gmetric
- Added
gmetric
component using a decoupled design, only providing the interface definition andNoop
implementation, with the real implementation in community components. Themetric
feature will only be enabled when specific implementations are introduced: Service Metrics
- Added
gproc
- Fixed an issue where process parameter parsing might fail under
windows
. - Improved
Signal
signal listening implementation, allowing adding signal handling methods at runtime.
- Fixed an issue where process parameter parsing might fail under
gview
- Fixed a robustness issue caused by the
os.Getwd
method execution failure.
- Fixed a robustness issue caused by the
gconv
json.RawMessage
supports receiving parameter conversions for theslice
type.- Fixed a recursive conversion failure issue caused by missing the
Deep
parameter in theMapDeep
internal conversion. - Improved the internal
Map
traversal logic usingMapRange
, enhancing execution performance.
Community Components
- Improvements to the community
contrib/drivers
database components:- Added support for the
Save
operation to thecontrib/drivers/dm
component. - Added support for the
Save
operation to thecontrib/drivers/mssql
component. - Added support for the
Save
operation to thecontrib/drivers/oracle
component and fixed an issue with write parameters not supporting thegdb.Raw
type. - Added support for the
Save
operation to thecontrib/drivers/pgsql
component. - Added support for the
Save
operation to thecontrib/drivers/sqlite
component. - Added support for the
Save
operation to thecontrib/drivers/sqlitecgo
component.
- Added support for the
- Added the
contrib/metric/otelmetric
component to supportOpenTelemetry Metric
: Service Metrics - Improvements to the
contrib/nosql/redis
component:- Added
SentinelUsername
andSentinelPassword
parameter configurations to expand support for theRedis Sentinel
mode: Redis - Configuration - Improved the
Redis
interface implementation, allowing developers to flexibly customize and extend the implementation of the community component objectredis.Redis
type: Redis - Interface
- Added
- Improved the
contrib/registry/etcd
component, allowing developers to configure verification information foretcd
connections. - Improvements to the
contrib/rpc/grpcx
component:- Safely truncate request content when the
tracing
feature is enabled. - Added support for the
logger
configuration option, allowing configuration of thegrpc server
log object through thelogger
configuration option in the configuration file: GRPC Server Configuration
- Safely truncate request content when the
- Improvements to the
contrib/trace/otlphttp
andcontrib/trace/otlpgrpc
components, fixing data loss issues oftrace
that may occur even with normalShutDown
in short process scenarios.
Development Tools
- Improved
gen dao
generatedentity
source file by addingorm
tags to enhance the efficiency of converting database query results intoentity
objects. - Improved the
gen service
command, fixing the inconsistent method order issue in the generated source files. - Improved the
build
command, changing the default value of the generated binary file storage directorypath
parameter from./temp
to.
to address the invalidation issue of the custom parameter. - Improved the
init
command by adding the-module/g
parameter to explicitly specify thego module
name when initializing a project. - Fixed an issue with
gen dao
deleting generateddao
source files when using theclear
parameter in multiple database generation configuration. - Fixed an issue with the
gen pbentity
command where the customjsonCase
parameter was invalid. - Fixed an issue with the
run
command's-w
specified listening directory parameter being ineffective.