common

package
v0.0.0-...-646f13b Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Db *gorm.DB

Functions

func InitDb

func InitDb(dbConfig *DbConfig)

func InitRedisDB

func InitRedisDB(redis *RedisConfig)

func Loading

func Loading()

Types

type Banner struct {
	Name    string `yaml:"name"`
	Loading bool   `yaml:"loading"`
}

type Config

type Config struct {
	Server *serverModel `yaml:"server"`
	DB     *DbConfig    `yaml:"db"`
	Redis  *RedisConfig `yaml:"redis"`
}

func NewConfig

func NewConfig() *Config

func (*Config) ReadConfig

func (config *Config) ReadConfig() *Config

type DbConfig

type DbConfig struct {
	Host        string  `yaml:"host"`
	Port        string  `yaml:"port"`
	Username    string  `yaml:"username"`
	Password    string  `yaml:"password"`
	Database    string  `yaml:"database"`
	Charset     string  `yaml:"charset"`
	Category    string  `yaml:"category"`
	PrintSql    bool    `yaml:"sql"`
	TablePrefix string  `yaml:"table_prefix"`
	DbPool      *DbPool `yaml:"pool"`
	DbInit      *DbInit `yaml:"init"`
}

type DbInit

type DbInit struct {
	Name   string `yaml:"name"`
	Status bool   `yaml:"status"`
}

type DbPool

type DbPool struct {
	MaxIdleConns    int           `yaml:"maxIdle"`
	MaxOpenConns    int           `yaml:"maxOpen"`
	ConnMaxLifetime time.Duration `yaml:"maxLifetime"`
}

type RDBManager

type RDBManager struct {
	OpenTx bool
	DsName string
	Db     *gorm.DB
	Tx     *gorm.Tx
	Errors []error
}

type RedisConfig

type RedisConfig struct {
	Host     string `yaml:"host"`
	Port     string `yaml:"port"`
	Password string `yaml:"password"`
	Database int    `yaml:"database"`
}

Jump to

Keyboard shortcuts

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