database

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2022 License: MIT Imports: 10 Imported by: 0

README

database

build tags with follow:

nomysql: disable mysql < default enable mysql >
nopostgres: disable postgres < default enable postgres > sqlite3: enable sqlite3 < default disable sqlite3 >

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Close

func Close(db *gorm.DB) error

func New

func New(c Config, config *gorm.Config, dialectorNews ...func(c Config) gorm.Dialector) (*gorm.DB, error)

func SetDBLogger

func SetDBLogger(db *gorm.DB, l logger.Interface)

SetDBLogger set db logger

Types

type Config

type Config struct {
	Dialect     string `yaml:"dialect" json:"dialect"` // mysql sqlite3 postgres and custom
	Dsn         string `yaml:"dsn" json:"dsn"`
	MaxIdleConn int    `yaml:"max_idle_conn" json:"max_idle_conn"`
	MaxOpenConn int    `yaml:"max_open_conn" json:"max_open_conn"`
}

Config 数据库配置

Jump to

Keyboard shortcuts

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