gf/contrib/drivers
2024-04-01 19:08:26 +08:00
..
clickhouse fix: for typo in comments for package contrib/drivers and gdb (#3366) 2024-03-12 20:40:20 +08:00
dm enhance: improve Save feature for drivers oracle and dm (#3426) 2024-04-01 19:08:26 +08:00
mssql feat: add metric feature support in goframe (#3138) 2024-03-24 21:18:30 +08:00
mysql fix: #3390 name&shor tag mapping failed to command input object for package gcmd (#3429) 2024-04-01 19:07:08 +08:00
oracle enhance: improve Save feature for drivers oracle and dm (#3426) 2024-04-01 19:08:26 +08:00
pgsql enhance: support save for Oracle (#3364) 2024-03-13 20:11:45 +08:00
sqlite fix: unit testing cases of contrib/drivers occasionally failed by using now time assertion (#3410) 2024-03-21 21:57:33 +08:00
sqlitecgo fix: unit testing cases of contrib/drivers occasionally failed by using now time assertion (#3410) 2024-03-21 21:57:33 +08:00
README.MD enhance: update contrib/drivers/README.MD (#3355) 2024-03-07 11:34:49 +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"

PostgreSQL

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

Note:

  • It does not support Replace features.

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.