Files
gf/contrib/drivers
John Guo 078c1bc7f9 feat: new version v2.10.1 (#4769)
This pull request updates the GoFrame framework and its related drivers
and configuration modules from version v2.10.0 to v2.10.1 across
multiple `go.mod` files and documentation. The main goal is to ensure
all dependencies consistently use the latest patch version, improving
compatibility and stability.

Dependency version updates:

* Updated `github.com/gogf/gf/v2` and related driver dependencies from
v2.10.0 to v2.10.1 in the following `go.mod` files:
  - `cmd/gf/go.mod`
  - `contrib/config/apollo/go.mod`
  - `contrib/config/consul/go.mod`
  - `contrib/config/kubecm/go.mod`
  - `contrib/config/nacos/go.mod`
  - `contrib/config/polaris/go.mod`
  - `contrib/drivers/clickhouse/go.mod`
  - `contrib/drivers/dm/go.mod`
  - `contrib/drivers/gaussdb/go.mod`
  - `contrib/drivers/mariadb/go.mod`
  - `contrib/drivers/mssql/go.mod`
  - `contrib/drivers/mysql/go.mod`
  - `contrib/drivers/oceanbase/go.mod`
  - `contrib/drivers/oracle/go.mod`
  - `contrib/drivers/pgsql/go.mod`
  - `contrib/drivers/sqlite/go.mod`
  - `contrib/drivers/sqlitecgo/go.mod`
  - `contrib/drivers/tidb/go.mod`

Documentation updates:

* Updated the contributors badge in `README.MD` and `README.zh_CN.MD` to
reflect version v2.10.1.
[[1]](diffhunk://#diff-01e6d9ffed056a02cae8d8a0ec5d476a64d017bf85c0d5a94bb23ca21f33f5aaL49-R49)
[[2]](diffhunk://#diff-c93759cb9a9500f20e551c741eb167fc72825fd638d36121357feb8253ce6ac1L49-R49)
2026-05-14 13:26:50 +08:00
..
2026-05-14 13:26:50 +08:00
2026-05-14 13:26:50 +08:00
2026-05-14 13:26:50 +08:00
2026-05-14 13:26:50 +08:00
2026-05-14 13:26:50 +08:00
2026-05-14 13:26:50 +08:00
2026-05-14 13:26:50 +08:00
2026-05-14 13:26:50 +08:00
2026-05-14 13:26:50 +08:00

Database drivers

Powerful database drivers for package gdb.

Installation

Let's take mysql for example.

go get github.com/gogf/gf/contrib/drivers/mysql/v2@latest

# Easy for copying:
go get github.com/gogf/gf/contrib/drivers/clickhouse/v2@latest
go get github.com/gogf/gf/contrib/drivers/dm/v2@latest
go get github.com/gogf/gf/contrib/drivers/gaussdb/v2@latest
go get github.com/gogf/gf/contrib/drivers/mariadb/v2@latest
go get github.com/gogf/gf/contrib/drivers/mssql/v2@latest
go get github.com/gogf/gf/contrib/drivers/oceanbase/v2@latest
go get github.com/gogf/gf/contrib/drivers/oracle/v2@latest
go get github.com/gogf/gf/contrib/drivers/pgsql/v2@latest
go get github.com/gogf/gf/contrib/drivers/sqlite/v2@latest
go get github.com/gogf/gf/contrib/drivers/sqlitecgo/v2@latest
go get github.com/gogf/gf/contrib/drivers/tidb/v2@latest

Choose and import the driver to your project:

import _ "github.com/gogf/gf/contrib/drivers/mysql/v2"

Commonly imported at top of main.go:

package main

import (
	_ "github.com/gogf/gf/contrib/drivers/mysql/v2"

	// Other imported packages.
)

func main() {
	// Main logics.
}

Supported Drivers

MySQL

import _ "github.com/gogf/gf/contrib/drivers/mysql/v2"

MariaDB

import _ "github.com/gogf/gf/contrib/drivers/mariadb/v2"

TiDB

import _ "github.com/gogf/gf/contrib/drivers/tidb/v2"

OceanBase

import _ "github.com/gogf/gf/contrib/drivers/oceanbase/v2"

GaussDB

import _ "github.com/gogf/gf/contrib/drivers/gaussdb/v2"

SQLite

import _ "github.com/gogf/gf/contrib/drivers/sqlite/v2"

cgo version

When the target is a 32-bit Windows system, the cgo version needs to be used.

import _ "github.com/gogf/gf/contrib/drivers/sqlitecgo/v2"

PostgreSQL

import _ "github.com/gogf/gf/contrib/drivers/pgsql/v2"

SQL Server

import _ "github.com/gogf/gf/contrib/drivers/mssql/v2"

Note:

  • InsertIgnore returns error if there is no primary key or unique index submitted with record.
  • It supports server version >= SQL Server2005
  • It ONLY supports datetime2 and datetimeoffset types for auto handling created_at/updated_at/deleted_at columns, because datetime type does not support microseconds precision when column value is passed as string.

Oracle

import _ "github.com/gogf/gf/contrib/drivers/oracle/v2"

Note:

  • It does not support LastInsertId.
  • InsertIgnore returns error if there is no primary key or unique index submitted with record.

ClickHouse

import _ "github.com/gogf/gf/contrib/drivers/clickhouse/v2"

Note:

  • It does not support InsertIgnore/InsertAndGetId features.
  • It does not support Save/Replace features.
  • It does not support Transaction feature.
  • It does not support RowsAffected feature.

DM

import _ "github.com/gogf/gf/contrib/drivers/dm/v2"

Note:

  • InsertIgnore returns error if there is no primary key or unique index submitted with record.

Custom Drivers

It's quick and easy, please refer to current driver source. It's quite appreciated if any PR for new drivers support into current repo.