GF(Go Frame) https://goframe.org is a modular, high-performance, production-grade Go development framework. It provides a comprehensive infrastructure including commonly used core development components such as caching, logging, files, timing, queues, arrays, collections, strings, timers, command-line, file locks, memory locks, object pools, connection pools, resource management, data validation, data encoding, file monitoring, scheduled tasks, database ORM, TCP/UDP components, process management/communication, concurrency-safe containers, etc. It offers core components for web service development, such as Router, Cookie, Session, Middleware, service registration, configuration management, template engine, and supports features like hot restart, hot update, multi-domain, multi-port, multi-service, HTTPS, Rewrite, and more.

GoFrame has a rich set of foundational modules, a complete toolchain, and detailed documentation. In the nearly two years since its open-source release, GoFrame has gained increasing recognition and support, evolving from obscurity to widespread application in enterprise-grade production projects such as microservices, IoT, blockchain, e-commerce systems, and banking. It has been tested in projects with hundreds of thousands to millions of users and was awarded the GVP Most Valuable Open-Source Project by Gitee in 2019. GoFrame is rapidly growing, with release iterations every 1-2 months, and an active community welcomes you to join the GoFrame family.

Finally, I wish everyone a Happy New Year 2020, the Year of the Rat!

New Features

  1. New year, new updates, a lot of updates to official documentation: https://goframe.org/index
  2. GoFrame toolchain updates: https://goframe.org/toolchain/cli
    • Added gf run hot compilation and run command;
    • Added gf docker Docker image compilation command;
    • Added gf gen model powerful model auto-generation command;
    • gf build command now supports configuration file settings;
    • Numerous command-line tool improvements;
    • Added automatic proxy setting feature;
  3. New features in Database ORM:

Feature Improvements

container

  1. garray
    • Added New*ArrayRange method for initializing arrays with specified number ranges.
    • Added Iterator* method for callback iteration of array elements.
    • Enhanced unit tests.
  2. gvar
    • Improved the implementation of MapStrStr, MapStrStrDeep methods.

net

  1. ghttp
    • Improved HTTP client to automatically recognize Content-Type for submitted parameters.
    • Request object added Parse method for easy object transformation and parameter validation.
    • All Request.GetPost* methods marked as deprecated, standardize client parameter submission to QueryString, Form, Body.
    • Removed Get/Post built-in variables during Response template parsing, added Query, Form, Request built-in variables: https://goframe.org/net/ghttp/response/template
    • Improved Response.WriteJson* and Response.WriteXml* methods, supporting string, []byte type parameters.
    • Server added GetRouterArray method for exposing and obtaining the route list to the application layer.
    • Server added Use method, alias of BindMiddlewareDefault, for global middleware registration.
    • Server added RouteOverWrite option to control automatic overwriting when registering route conflicts, disabled by default with a warning.
    • Server added Graceful option to control the activation/deactivation of graceful restart features in a single service scenario, enabled by default.
    • Enhanced unit tests.
  2. gtcp
    • Improved data packet sending and receiving functionality under a simple protocol.
    • Changed the default cache expiration time of the connection pool from 30 seconds to 10 seconds.
    • Enhanced unit tests.

database

  1. gdb

    • Added As data table alias method.

    • Improved automatic recognition and addition of safe characters for tables and fields.

    • Added DB method for switching database objects.

    • Added TX method for supporting chain operations within transactions.

    • Enhanced unit tests.

os

  1. gcfg

    • Added GetMapStrStr method.
  2. gcmd

    • Added strict parameter for strict argument parsing, default is strict parsing, errors if specified parameter/option name does not exist.
  3. genv

    • Improved Remove method to support deletion of multiple environment variables.
  4. gfile

    • Improved TempDir method for getting temporary directory, default is /tmp in *nix systems.
    • Added ReadLines, ReadByteLines methods for line-by-line callback file reading.
    • Added Copy* methods for file/directory copying, supports recursion.
    • Added Replace* methods for replacing file contents within directories, supports recursion.
    • Improved Scan* methods for retrieving all files/directories under a specified directory, supports file mode specification, supports recursion.
    • Enhanced unit tests.
  5. gproc

    • Improved command-line running methods.
    • Improved Shell command file search logic.
    • Improved experimental inter-process communication design.
  6. gtime

    • Marked timestamp methods Second, Millisecond, Microsecond, Nanosecond in package methods and Time objects as deprecated, replaced with Timestamp, TimestampMilli, TimestampMicro, TimestampNano.
    • Note that these changes may have compatibility issues with previous versions.
  7. gview

    • Improved parsing functionality and cache design.
    • Added encode, decode HTML encoding/decoding template functions.
    • Added concat string joining template function.
    • Added dump template function, similar to g.Dump method.
    • Added AutoEncode option for automatic HTML content encoding, useful for preventing XSS, disabled by default. Note that this feature does not affect the include built-in function: https://goframe.org/os/gview/xss
    • Enhanced unit tests.

crypto

  1. gmd5
    • Added MustEncrypt, MustEncryptBytes, MustEncryptString, MustEncryptFile methods.
  2. gsha1
    • Added MustEncryptFile method.

encoding

  1. gbase64
    • Added MustEncodeFile, MustEncodeFileToString, MustDecode, MustDecodeToString methods.
  2. gjson/gparser
    • Added GetMapStrStr method.
    • Added Must* methods to trigger panic error on failure to convert specified data format, instead of returning an error parameter.

util

  1. gconv
    • Improved Convert method to add conversion support for []int32, []int64, []uint, []uint32, []uint64, []float32, []float64 data types.
    • Improved String method support for converting pointer parameters.
    • Improved code structure and performance of Map* map conversion methods.
    • Added Floats, Float32s, Float64s methods for conversion to []float32, []float64 types.
    • Added Ints, Int32s, Int64s methods for conversion to []int, []int32, []int64 types.
    • Added Uints, Uint32s, Uint64s methods for conversion to []uint, []uint32, []uint64 types.
    • Enhanced unit tests.

frame

  1. gins
    • All singleton objects trigger panic error when retrieval fails.

Bug Fix

  1. Added compatibility support for common erroneous route formats like /user//index.
  2. Fixed issue with interval time units for data reception in gtcp/gudp.
  3. Fixed issue with imprecise file existence checks in gfile/gspath/gfsnotify packages.
  4. Fixed blocking issue with gproc.Kill method on windows.
  5. Fixed array overflow issue in gstr.TrimLeftStr/gstr.TrimRightStr when the replaced string length was less than the replacement string length.