2022-01-24 14:47:22 +08:00
|
|
|
# drivers
|
2022-01-24 14:41:23 +08:00
|
|
|
Database drivers for package gdb.
|
|
|
|
|
|
|
|
# Installation
|
|
|
|
Let's take `pgsql` for example.
|
|
|
|
```
|
2022-01-27 12:04:46 +08:00
|
|
|
go get -u github.com/gogf/gf/contrib/drivers/pgsql/v2
|
2022-01-24 14:41:23 +08:00
|
|
|
```
|
|
|
|
|
|
|
|
Choose and import the driver to your project:
|
|
|
|
```
|
2022-01-27 12:04:46 +08:00
|
|
|
import _ "github.com/gogf/gf/contrib/drivers/pgsql/v2"
|
2022-01-24 14:41:23 +08:00
|
|
|
```
|
|
|
|
|
|
|
|
# Supported Drivers
|
|
|
|
|
|
|
|
## MySQL
|
|
|
|
|
|
|
|
BuiltIn supported, nothing todo.
|
|
|
|
|
|
|
|
## SQLite
|
|
|
|
```
|
2022-01-27 12:04:46 +08:00
|
|
|
import _ "github.com/gogf/gf/contrib/drivers/sqlite/v2"
|
2022-01-24 14:41:23 +08:00
|
|
|
```
|
|
|
|
Note:
|
|
|
|
- It does not support `Save/Replace` features.
|
|
|
|
|
|
|
|
## PostgreSQL
|
|
|
|
```
|
2022-01-27 12:04:46 +08:00
|
|
|
import _ "github.com/gogf/gf/contrib/drivers/pgsql/v2"
|
2022-01-24 14:41:23 +08:00
|
|
|
```
|
|
|
|
Note:
|
|
|
|
- It does not support `Save/Replace` features.
|
|
|
|
- It does not support `LastInsertId`.
|
|
|
|
|
|
|
|
## SQL Server
|
|
|
|
```
|
2022-01-27 12:04:46 +08:00
|
|
|
import _ "github.com/gogf/gf/contrib/drivers/mssql/v2"
|
2022-01-24 14:41:23 +08:00
|
|
|
```
|
|
|
|
Note:
|
|
|
|
- It does not support `Save/Replace` features.
|
|
|
|
- It does not support `LastInsertId`.
|
|
|
|
- It supports server version >= `SQL Server2005`
|
|
|
|
|
|
|
|
## Oracle
|
|
|
|
```
|
2022-01-27 12:04:46 +08:00
|
|
|
import _ "github.com/gogf/gf/contrib/drivers/oracle/v2"
|
2022-01-24 14:41:23 +08:00
|
|
|
```
|
|
|
|
Note:
|
|
|
|
- It does not support `Save/Replace` features.
|
|
|
|
- It does not support `LastInsertId`.
|
|
|
|
|
|
|
|
# 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.
|