gormx

package
v1.2.12 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Config

func Config(v *viper.Viper, configureFn ...ConfigureFn)

Config config db, default use mysql

func Get

func Get(name string) *gorm.DB

func MySQLDbConfig

func MySQLDbConfig(cfg DbConfig) *gorm.DB

MySQLDbConfig for mysql config

Types

type ConfigureFn

type ConfigureFn func(DbConfig) *gorm.DB

type DbConfig

type DbConfig struct {
	Name                         string `yaml:"name"`
	Uri                          string `yaml:"uri"`
	MaxConn                      int    `yaml:"maxConn"`
	MaxIdleConn                  int    `yaml:"maxIdleConn"`
	ConnMaxLifetimeInMillisecond int    `yaml:"connMaxLifetimeInMillisecond"`
	QueryFields                  bool   `yaml:"queryFields"`
	CreateBatchSize              int    `yaml:"createBatchSize"`
}

Jump to

Keyboard shortcuts

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