1
0
mirror of https://github.com/ManyakRus/crud_generator.git synced 2024-12-22 00:36:41 +02:00
crud_generator/vendor/gorm.io/driver/postgres
2024-03-06 16:03:41 +03:00
..
.gitignore новый 2023-09-28 17:45:44 +03:00
error_translator.go новый 2023-10-24 18:03:04 +03:00
License новый 2023-09-28 17:45:44 +03:00
migrator.go сделал NEED_CREATE_CACHE_API 2024-03-06 16:03:41 +03:00
postgres.go сделал NEED_CREATE_CACHE_API 2024-03-06 16:03:41 +03:00
README.md новый 2023-09-28 17:45:44 +03:00

GORM PostgreSQL Driver

Quick Start

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

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 for details.