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 💖!

v2.7 2024-04-09 - 图1

Component Improvements

  1. gdb
    1. Added Stats interface definition and implementation for obtaining connection pool information maintained by the current database orm object: ORM Senior - Connection Pool
    2. Added FormatUpsert interface definition and implementation, used for writing/updating operations for different database types, i.e., Save operation.
    3. Added SqlType type, changing the existing sql type type definition from string to SqlType type.
    4. Added Model.OnConflict method for implementing update policy when field unique key conflicts for some database types, particularly for Save operation.
    5. Fixed the issue where the ClearTableFieldsAll method was not effective.
  2. ghttp
    1. Added MiddlewareNeverDoneCtx middleware, which developers can choose to use to avoid issues related to context cancel on the server side when clients cancel requests: FAQ
    2. Added monitoring metric implementation for http server, which is disabled by default and does not affect performance, unless the metrics feature is enabled: HTTPServer - Metrics
    3. Improved tracing records, changing the span name from query uri to route uri for easier aggregation when viewing.
    4. Changed the type of EnterTime and LeaveTime properties in the Request object from int64 to *gtime.Time.
    5. Marked the WebSocket method as deprecated, it will be removed in future major versions, along with the removal of http server's built-in coupling support for websocket. It is recommended to use other open-source websocket components with http server for more decoupled flexibility in the future.
    6. Fixed a memory issue caused by large file uploads due to the Request Body being readable multiple times by default.
    7. Fixed the issue where the pattern parameter of the StartPProfServer method was ineffective.
    8. Added the Access-Control-Expose-Headers Header return to the Request.ServeFileDownload method to support ajax file requests.
    9. Added SwaggerUITemplate configuration option to the service configuration for quickly configuring the HTML content of the SwaggerUI page.
    10. The http server no longer prints built-in middleware when starting route printing.
  3. gclient
    1. Fixed the issue that forced all http requests to go through service discovery domain name resolution when service discovery is enabled.
    2. Added monitoring metric implementation for http client, which is disabled by default and does not affect performance, unless the metrics feature is enabled: HTTPClient - Metrics
  4. gcron
    1. Added an ignore symbol #, using it as a placeholder for the second-level field in the cron pattern, indicating the ignore of the second-level field, converting a 6-segment cron pattern to a 5-segment linux crontab pattern: Cron Job - Expressions
    2. Fixed an issue where specified second-level tasks (for example 2 * * * * *) might execute twice if there is inaccurate time at the underlying level.
  5. gerror
    1. Fixed an issue with the recursive logic being ineffective in the gerror.HasCode method.
  6. g
    1. Improved the DumpJson method for printing any variables in JSON format.
  7. gcache
    1. Fixed an issue caused by excessive goroutine due to the creation of a large number of Cache objects.
  8. gcmd
    1. Added RunWithSpecificArgs method, used to run command objects with custom arguments.
    2. Fixed the issue of parameter loss due to conflicts between parameter struct names and struct tag names in some scenarios.
  9. gfsnotify
    1. Fixed a panic issue that might occur when the gfsnotify object is closed.
  10. glog
    1. Fixed the redundant rotate issue of .gz suffix log compressed files related to the rotate feature.
  11. gmetric
    1. Added gmetric component using a decoupled design, only providing the interface definition and Noop implementation, with the real implementation in community components. The metric feature will only be enabled when specific implementations are introduced: Service Metrics
  12. gproc
    1. Fixed an issue where process parameter parsing might fail under windows.
    2. Improved Signal signal listening implementation, allowing adding signal handling methods at runtime.
  13. gview
    1. Fixed a robustness issue caused by the os.Getwd method execution failure.
  14. gconv
    1. json.RawMessage supports receiving parameter conversions for the slice type.
    2. Fixed a recursive conversion failure issue caused by missing the Deep parameter in the MapDeep internal conversion.
    3. Improved the internal Map traversal logic using MapRange, enhancing execution performance.

Community Components

  1. Improvements to the community contrib/drivers database components:
    1. Added support for the Save operation to the contrib/drivers/dm component.
    2. Added support for the Save operation to the contrib/drivers/mssql component.
    3. Added support for the Save operation to the contrib/drivers/oracle component and fixed an issue with write parameters not supporting the gdb.Raw type.
    4. Added support for the Save operation to the contrib/drivers/pgsql component.
    5. Added support for the Save operation to the contrib/drivers/sqlite component.
    6. Added support for the Save operation to the contrib/drivers/sqlitecgo component.
  2. Added the contrib/metric/otelmetric component to support OpenTelemetry Metric: Service Metrics
  3. Improvements to the contrib/nosql/redis component:
    1. Added SentinelUsername and SentinelPassword parameter configurations to expand support for the Redis Sentinel mode: Redis - Configuration
    2. Improved the Redis interface implementation, allowing developers to flexibly customize and extend the implementation of the community component object redis.Redis type: Redis - Interface
  4. Improved the contrib/registry/etcd component, allowing developers to configure verification information for etcd connections.
  5. Improvements to the contrib/rpc/grpcx component:
    1. Safely truncate request content when the tracing feature is enabled.
    2. Added support for the logger configuration option, allowing configuration of the grpc server log object through the logger configuration option in the configuration file: GRPC Server Configuration
  6. Improvements to the contrib/trace/otlphttp and contrib/trace/otlpgrpc components, fixing data loss issues of trace that may occur even with normal ShutDown in short process scenarios.

Development Tools

  1. Improved gen dao generated entity source file by adding orm tags to enhance the efficiency of converting database query results into entity objects.
  2. Improved the gen service command, fixing the inconsistent method order issue in the generated source files.
  3. Improved the build command, changing the default value of the generated binary file storage directory path parameter from ./temp to . to address the invalidation issue of the custom parameter.
  4. Improved the init command by adding the -module/g parameter to explicitly specify the go module name when initializing a project.
  5. Fixed an issue with gen dao deleting generated dao source files when using the clear parameter in multiple database generation configuration.
  6. Fixed an issue with the gen pbentity command where the custom jsonCase parameter was invalid.
  7. Fixed an issue with the run command’s -w specified listening directory parameter being ineffective.