Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/go-gorm/postgres
GORM PostgreSQL driver
https://github.com/go-gorm/postgres
gorm gorm-postgresql-driver postgresql
Last synced: 3 days ago
JSON representation
GORM PostgreSQL driver
- Host: GitHub
- URL: https://github.com/go-gorm/postgres
- Owner: go-gorm
- License: mit
- Created: 2020-06-02T01:32:31.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2024-12-11T23:35:21.000Z (about 1 month ago)
- Last Synced: 2025-01-11T22:00:08.898Z (10 days ago)
- Topics: gorm, gorm-postgresql-driver, postgresql
- Language: Go
- Homepage:
- Size: 171 KB
- Stars: 244
- Watchers: 6
- Forks: 129
- Open Issues: 26
-
Metadata Files:
- Readme: README.md
- License: License
Awesome Lists containing this project
README
# 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.