gf/contrib/drivers
John Guo 5a8b33fa09
fix gf.yaml (#2385)
* fix gf.yaml

* up
2023-01-03 14:33:41 +08:00
..
clickhouse fix gf.yaml (#2385) 2023-01-03 14:33:41 +08:00
dm Feature/driver-dm fix something is invalid in dm (#2158) 2022-09-28 10:02:48 +08:00
mssql change result data type of function Count from int to int64 for package gdb (#2298) 2022-11-17 19:47:17 +08:00
mysql revert from int64 to int for returning value of Count (#2378) 2022-12-30 16:54:43 +08:00
oracle change result data type of function Count from int to int64 for package gdb (#2298) 2022-11-17 19:47:17 +08:00
pgsql change result data type of function Count from int to int64 for package gdb (#2298) 2022-11-17 19:47:17 +08:00
sqlite change result data type of function Count from int to int64 for package gdb (#2298) 2022-11-17 19:47:17 +08:00
README.MD package comments and readme update (#2182) 2022-10-09 21:23:55 +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

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.