Skip to main content
Version: 2.8.x(Latest)

We are pleased to announce the official release of GoFrame version v2.8.0! This update brings significant improvements and new features, enhancing GoFrame in terms of development efficiency, execution performance, stability, and extensibility.

Version Highlights

  1. Compatibility Update

    • GoFrame v2.8.0 requires a minimum Golang version of 1.20 to provide more efficient performance and stability.
    • The container/gring component has been deprecated, and the contrib/trace/jaeger component has been removed from the source code repository, simplifying dependency management.
  2. Component Improvements

    • The database/gdb module now supports created_at/updated_at/deleted_at integer timestamp fields, unix socket connections, time/year field types, and introduces the Model.Exist method, significantly improving the flexibility and efficiency of database operations.
    • The util/gconv component leverages type caching to enhance conversion performance, with conversion performance for complex data types improved by approximately 300%.
    • The net/ghttp and net/gudp network service components have optimized parameter configurations and request processing logic, providing a more streamlined development experience.
  3. Development Tools Upgrade

    • The gf init command supports generating a multi-application project structure within a single repository.
    • Optimizations to commands like gf gen ctrl, gf gen dao, and gf run, further enhance code generation flexibility and execution efficiency, simplifying project setup processes.
  4. Community Component Support

    • Added support for the latest features in multiple community drivers such as contrib/drivers/mssql and contrib/registry/etcd, improving integration with external services.

Future Outlook

The GoFrame team thanks all community users for their support. We will continue to listen to community feedback to provide users with richer features and more efficient development support.

Special Thanks

💖💖💖 Thanks to all the contributing developers for this release 💖💖💖

alt text

Main Content

This release contains numerous changes. Below are the major updates in this version; for a detailed Change Log, please refer to: https://github.com/gogf/gf/releases/tag/v2.8.0

For comprehensive code changes, please refer to: https://github.com/gogf/gf/compare/v2.7.0...v2.8.0

Compatibility Notice

  1. The minimum Golang version requirement has been adjusted from 1.18 to 1.20.
  2. The container/gring component is marked as deprecated and will no longer be maintained.
  3. The contrib/trace/jaeger component has been removed from the source code repository.
  4. The parameter of Load* methods in the encoding/gjson component has been adjusted from interface{} to []byte to improve performance.
  5. The port parameter of the StartPProfServer method in the net/ghttp component has been changed from port int to address string for increased flexibility.
  6. The net/gudp component has been refactored, with individual method parameter adjustments: UDP

Component Improvements

  1. database/gdb

    • Time maintenance features have been enhanced to support integer fields. When created_at/updated_at/deleted_at are integer fields, they will be updated with timestamps. For details, see: ORM Model - Time Fields
    • Added the Model.Exist method to determine if data that meets given conditions exists: Model Query - Exist
    • Added support for time/year field types in the database: ORM Senior - Type Recognition
    • Added the OrderRandomFunction interface method, implemented and supported the OrderRandom sorting method for common databases.
    • Improved the Model.Fields method to support gdb.Raw type parameters: ORM Model - Fields Retrieval
    • Enhanced the With feature in orm tags to support unscoped: Model Association - With
    • Added support for unix socket local database service connections in the configuration file.
    • Removed sql statements from trace information to reduce the size of the trace package.
    • Improved performance of query result conversion to struct.
  2. net/ghttp

    • Removed XxxReq/XxxRes naming restrictions for input and output objects in route registrations.
    • Adjusted the port parameter of StartPProfServer from port int to address string for increased flexibility.
    • Removed request/response data from trace information to reduce the size of the trace package.
    • Fixed graceful shutdown issues with the /debug/admin/shutdown interface.
  3. net/goai

    • Allowed specifying parameter types in request/response structure attributes using the type tag.
  4. container/gtree

    • Refactored gtree implementation using the third-party data structure component github.com/emirpasic/gods to enhance extensibility and maintainability.
  5. encoding/gjson

    • Adjusted Load* method parameters from interface{} to []byte to improve performance.
  6. os/gcron

    • Added StopGracefully method to allow waiting for currently executing scheduled tasks to complete before stopping: Cron Job - Usage
  7. os/gfsnotify

    • Improved file recursive monitoring implementation so that when a directory is being monitored, newly created subdirectories within it, or their subdirectories, will also be recursively monitored: File Watching
  8. test/gtest

    • Improved AssertIN/AssertNI assertion methods by adding support for substring containment assertions.
  9. util/gvalid

    • Added required-if-all validation rule, where a parameter is mandatory if all specified parameters and their values are equal: Data Validation - Rules
    • Enhanced phone validation rule by adding support for 171 series phone numbers.
  10. util/gconv

    • Enhanced conversion performance with type caching, improving conversion performance for complex data types by approximately 300%.

Community Components

  1. drivers/mssql

    • Changed the base driver from github.com/denisenkom/go-mssqldb to the official component github.com/microsoft/go-mssqldb.
  2. contrib/drivers/pgsql

    • Added support for InsertIgnore operations.
    • Added support for operations from Golang array types to database array field types.
  3. contrib/registry/etcd

    • Added DialTimeout and AutoSyncInterval configuration options.
  4. contrib/registry/nacos

    • Replaced the dependency on github.com/joy999/nacos-sdk-go with the official component github.com/nacos-group/nacos-sdk-go/v2.
  5. contrib/rpc/grpcx

    • Removed request/response data from trace information to reduce the size of the trace package.
    • Since the grpc component has enabled the grpc.Dial method, grpc.NewClient is now used to replace grpc.Dial.
  6. contrib/sdk/httpclient

    • Added Handler interface to allow users to customize the handling of HTTP Client return data.

Development Tools

  1. Improved the gf init command by adding the -a/monoApp option for creating new application project templates in a large repository: Project Scaffold

  2. Enhanced the gf pack command by adding support for command parameter options from a configuration file, with the configuration path as gfcli.pack.

  3. Enhanced the gf tpl command by adding support for command parameter options from a configuration file, with the configuration path as gfcli.tpl.parse.

  4. Improved the gf gen ctrl command by re-implementing parsing logic using AST, increasing the accuracy of generated Go code file content, and enhancing the extensibility of the feature.

  5. Improved the gf run command:

    • Added support for command parameter options from a configuration file, with the configuration path as gfcli.run.
    • Automatically deletes temporary old process binary files when a new process replaces the old one at the end of a temporary subprocess.
  6. Improved the gf gen dao command:

    • Added field mapping feature to support specifying field configurations for generated Golang data types: Dao/Do/Entity Generating
    • Automatically identifies integer fields with a length of 1, such as bit(1)/tinyint(1)/int(1), as bool type Golang data types.
    • Automatically reads the directory name of generated code files as the package name for generating dao/do/entity files.
    • Due to database restrictions, the cli has removed default support for the dm database. If needed, please manually modify the source code to install cli.
    • Fixed the issue where the link parameter becomes invalid when both the link parameter and configuration file exist simultaneously.