github.com/wangyougui/gf/v2@v2.6.5/contrib/drivers/README.MD (about) 1 # drivers 2 Powerful database drivers for package gdb. 3 4 # Installation 5 Let's take `mysql` for example. 6 ``` 7 go get -u github.com/wangyougui/gf/contrib/drivers/mysql/v2 8 ``` 9 10 Choose and import the driver to your project: 11 ``` 12 import _ "github.com/wangyougui/gf/contrib/drivers/mysql/v2" 13 ``` 14 15 Commonly imported at top of `main.go`: 16 ```go 17 package main 18 19 import ( 20 _ "github.com/wangyougui/gf/contrib/drivers/mysql/v2" 21 22 // Other imported packages. 23 ) 24 25 func main() { 26 // Main logics. 27 } 28 ``` 29 30 # Supported Drivers 31 32 ## MySQL/MariaDB/TiDB 33 34 ``` 35 import _ "github.com/wangyougui/gf/contrib/drivers/mysql/v2" 36 ``` 37 38 ## SQLite 39 ``` 40 import _ "github.com/wangyougui/gf/contrib/drivers/sqlite/v2" 41 ``` 42 43 ## PostgreSQL 44 ``` 45 import _ "github.com/wangyougui/gf/contrib/drivers/pgsql/v2" 46 ``` 47 Note: 48 - It does not support `Replace` features. 49 50 ## SQL Server 51 ``` 52 import _ "github.com/wangyougui/gf/contrib/drivers/mssql/v2" 53 ``` 54 Note: 55 - It does not support `Save/Replace` features. 56 - It does not support `LastInsertId`. 57 - It supports server version >= `SQL Server2005` 58 - 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. 59 60 ## Oracle 61 ``` 62 import _ "github.com/wangyougui/gf/contrib/drivers/oracle/v2" 63 ``` 64 Note: 65 - It does not support `Save/Replace` features. 66 - It does not support `LastInsertId`. 67 68 ## ClickHouse 69 ``` 70 import _ "github.com/wangyougui/gf/contrib/drivers/clickhouse/v2" 71 ``` 72 Note: 73 - It does not support `InsertIgnore/InsertGetId` features. 74 - It does not support `Save/Replace` features. 75 - It does not support `Transaction` feature. 76 - It does not support `RowsAffected` feature. 77 78 ## DM 79 ``` 80 import _ "github.com/wangyougui/gf/contrib/drivers/dm/v2" 81 ``` 82 Note: 83 - It does not support `Replace` features. 84 85 86 87 # Custom Drivers 88 89 It's quick and easy, please refer to current driver source. 90 It's quite appreciated if any PR for new drivers support into current repo.