mirror of
https://gitee.com/johng/gf
synced 2026-06-07 02:12:11 +08:00
This PR includes the following updates and fixes: - **Dependency upgrades**: Updated all dependencies in `go.mod` to their latest versions to ensure compatibility and leverage the latest features and fixes. - **Security fixes**: - Resolved known vulnerabilities in `golang.org/x/net` by upgrading to the latest secure version. - Addressed security issues in `golang.org/x/crypto` by upgrading to the latest secure version. These changes improve the overall security and stability of the project. Please review the changes and ensure compatibility with the updated dependencies. --------- Co-authored-by: hailaz <739476267@qq.com>
Database 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
# Easy to copy
go get -u github.com/gogf/gf/contrib/drivers/clickhouse/v2
go get -u github.com/gogf/gf/contrib/drivers/dm/v2
go get -u github.com/gogf/gf/contrib/drivers/mssql/v2
go get -u github.com/gogf/gf/contrib/drivers/oracle/v2
go get -u github.com/gogf/gf/contrib/drivers/pgsql/v2
go get -u github.com/gogf/gf/contrib/drivers/sqlite/v2
go get -u github.com/gogf/gf/contrib/drivers/sqlitecgo/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"
cgo version
When the target is a 32-bit Windows system, the cgo version needs to be used.
import _ "github.com/gogf/gf/contrib/drivers/sqlitecgo/v2"
PostgreSQL
import _ "github.com/gogf/gf/contrib/drivers/pgsql/v2"
Note:
- It does not support
Replacefeatures.
SQL Server
import _ "github.com/gogf/gf/contrib/drivers/mssql/v2"
Note:
- It does not support
Replacefeatures. - 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
Replacefeatures. - It does not support
LastInsertId.
ClickHouse
import _ "github.com/gogf/gf/contrib/drivers/clickhouse/v2"
Note:
- It does not support
InsertIgnore/InsertGetIdfeatures. - It does not support
Save/Replacefeatures. - It does not support
Transactionfeature. - It does not support
RowsAffectedfeature.
DM
import _ "github.com/gogf/gf/contrib/drivers/dm/v2"
Note:
- It does not support
Replacefeatures.
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.