You've already forked golang-base-project
Initial commit
This commit is contained in:
31
vendor/gorm.io/driver/postgres/README.md
generated
vendored
Normal file
31
vendor/gorm.io/driver/postgres/README.md
generated
vendored
Normal file
@ -0,0 +1,31 @@
|
||||
# GORM PostgreSQL Driver
|
||||
|
||||
## Quick Start
|
||||
|
||||
```go
|
||||
import (
|
||||
"gorm.io/driver/postgres"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
// https://github.com/jackc/pgx
|
||||
dsn := "host=localhost user=gorm password=gorm dbname=gorm port=9920 sslmode=disable TimeZone=Asia/Shanghai"
|
||||
db, err := gorm.Open(postgres.Open(dsn), &gorm.Config{})
|
||||
```
|
||||
|
||||
## Configuration
|
||||
|
||||
```go
|
||||
import (
|
||||
"gorm.io/driver/postgres"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
db, err := gorm.Open(postgres.New(postgres.Config{
|
||||
DSN: "host=localhost user=gorm password=gorm dbname=gorm port=9920 sslmode=disable TimeZone=Asia/Shanghai", // data source name, refer https://github.com/jackc/pgx
|
||||
PreferSimpleProtocol: true, // disables implicit prepared statement usage. By default pgx automatically uses the extended protocol
|
||||
}), &gorm.Config{})
|
||||
```
|
||||
|
||||
|
||||
Checkout [https://gorm.io](https://gorm.io) for details.
|
Reference in New Issue
Block a user