db

package
v0.3.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 30, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDB

func NewDB(cfg Config) (*gorm.DB, error)

Types

type Config

type Config struct {
	Dialect string `json:"dialect,omitempty" yaml:"dialect"`

	// Examples:
	//   - SQL Server: "sqlserver://gorm:LoremIpsum86@localhost:9930?database=gorm"
	//   - MySQL: user:pass@tcp(127.0.0.1:3306)/dbname?charset=utf8mb4&parseTime=True&loc=Local
	//   - PostgreSQL: user=gorm password=gorm dbname=gorm port=9920 sslmode=disable TimeZone=Asia/Shanghai
	//   - SQLite: "file.db?_busy_timeout=5000"
	DSN string `json:"dsn,omitempty" yaml:"dsn"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL