gorm

package
v2.0.0-beta9 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(conf Config) (db *gorm.DB, err error)

Types

type Config

type Config struct {
	Driver          string        `koanf:"driver"`             // Optional, Example: mysql, postgres. Default: mysql
	DSN             string        `koanf:"dsn"`                // Required, Example: root:123456@tcp(127.0.0.1:3306)/test?charset=utf8&parseTime=True&loc=Local
	ConnMaxIdleTime time.Duration `koanf:"conn_max_idle_time"` // Optional, Default: 1 hour
	ConnMaxLifetime time.Duration `koanf:"conn_max_lifetime"`  // Optional, Default: 24 hours
	MaxIdleConns    int           `koanf:"max_idle_conns"`     // Optional, Default: 10
	MaxOpenConns    int           `koanf:"max_open_conns"`     // Optional, Default: 100
}

Jump to

Keyboard shortcuts

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