gf/contrib/drivers
2023-08-07 21:03:56 +08:00
..
clickhouse improve data converting for DB.DoInsert/DoUpdate (#2830) 2023-08-07 21:03:56 +08:00
dm improve data converting for DB.DoInsert/DoUpdate (#2830) 2023-08-07 21:03:56 +08:00
mssql change minimum golang version from v1.15 to v1.18 (#2820) 2023-08-01 21:15:28 +08:00
mysql change minimum golang version from v1.15 to v1.18 (#2820) 2023-08-01 21:15:28 +08:00
oracle change minimum golang version from v1.15 to v1.18 (#2820) 2023-08-01 21:15:28 +08:00
pgsql fix: psgql tx unsupport LastInsertId (#2815) 2023-08-03 19:59:22 +08:00
sqlite change minimum golang version from v1.15 to v1.18 (#2820) 2023-08-01 21:15:28 +08:00
sqlitecgo Bump golang.org/x/text from 0.3.8-0.20211105212822-18b340fc7af2 to 0.3.8 in /contrib/drivers/sqlitecgo (#2835) 2023-08-03 21:12:45 +08:00
README.MD support microseconds resolution for created_at/updated_at/deleted_at (#2512) 2023-03-20 09:57:37 +08:00

drivers

Powerful database drivers for package gdb.

Installation

Let's take mysql for example.

go get -u github.com/gogf/gf/contrib/drivers/mysql/v2

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/MariaDB/TiDB

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

SQLite

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

Note:

  • It does not support Save features.

PostgreSQL

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

Note:

  • It does not support Save/Replace features.
  • It does not support LastInsertId.

SQL Server

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

Note:

  • It does not support Save/Replace features.
  • It does not support LastInsertId.
  • 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 Save/Replace features.
  • It does not support LastInsertId.

ClickHouse

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

Note:

  • It does not support InsertIgnore/InsertGetId 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:

  • It does not support Replace features.

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.