db

package
v0.0.0-...-c188a41 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitDataSource

func InitDataSource(openFunc func(dsn string) gorm.Dialector, models []interface{})

func InitRedis

func InitRedis()

func NextID

func NextID() int64

func Orm

func Orm() *sql.DB

func Redis

func Redis() redis.Cmdable

Types

type DBConfig

type DBConfig struct {
	Host             string       `yaml:"host"`
	Port             int          `yaml:"port"`
	User             string       `yaml:"user"`
	Password         string       `yaml:"password"`
	DB               string       `yaml:"db"`
	Url              string       `yaml:"url"`
	DDL              bool         `yaml:"ddl"`
	Debug            bool         `yaml:"debug"`
	SlowSqlThreshold int64        `yaml:"slowSqlThreshold"`
	TableNamePrefix  string       `yaml:"tableNamePrefix"`
	Pool             DBPoolConfig `yaml:"pool" mapstructure:"pool"`
}

type DBPoolConfig

type DBPoolConfig struct {
	MaxOpenConns    int   `yaml:"maxOpenConns"`
	MaxIdleConns    int   `yaml:"maxIdleConns"`
	ConnMaxLifeTime int64 `yaml:"connMaxLifeTime"`
	ConnMaxIdleTime int64 `yaml:"connMaxIdleTime"`
}

type RConfig

type RConfig struct {
	Mode       string      `yaml:"mode"`
	Debug      bool        `yaml:"debug"`
	Address    []string    `yaml:"addr" mapstructure:"addr"`
	Password   string      `yaml:"password"`
	MasterName string      `yaml:"masterName"`
	Pool       RPoolConfig `yaml:"pool" mapstructure:"pool"`
}

type RPoolConfig

type RPoolConfig struct {
	Size        int   `yaml:"size"`
	MinIdle     int   `yaml:"minIdleSize"`
	MaxAge      int64 `yaml:"maxAge"`
	PoolTimeout int64 `yaml:"poolTimeout"`
	IdleTimeout int64 `yaml:"idleTimeout"`
}

Jump to

Keyboard shortcuts

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