config

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Config *AppConfig

	DBMusic     *gorm.DB
	DBWarTank   *gorm.DB
	DBWarTankCN *gorm.DB

	RedisDefault *redis.Client
)
View Source
var (
	EnvFlag = &cli.StringFlag{
		Name:    "env",
		Aliases: []string{"e"},
		Usage:   "设置程序使用的环境,根据config文件配置决定",
		Value:   "lan",
	}
)

Functions

func InitCliContext added in v1.1.8

func InitCliContext(ctx *cli.Context, callbacks ...func()) error

func InitDBMusic added in v1.1.8

func InitDBMusic()

func InitDBWarTank added in v1.3.0

func InitDBWarTank()

func InitDBWarTankCN added in v1.1.8

func InitDBWarTankCN()

func InitRedisDefault added in v1.1.8

func InitRedisDefault()

func LoadConfigFile added in v1.1.8

func LoadConfigFile(e *Environment, callbacks ...func()) error

Types

type AppConfig

type AppConfig struct {
	MySQL types.Map[string]       `yaml:"mysql"`
	Redis types.Map[*RedisConfig] `yaml:"redis"`
}

func (*AppConfig) String

func (a *AppConfig) String() string

type Environment added in v1.1.8

type Environment struct {
	Env string `yaml:"env"`
}

func (*Environment) String added in v1.1.8

func (e *Environment) String() string

type File added in v1.1.8

type File = types.Map[*AppConfig]

type RedisConfig added in v1.1.8

type RedisConfig struct {
	Addr     string `yaml:"addr"`
	Password string `yaml:"password"`
	DB       int    `yaml:"db"`
}

func (*RedisConfig) String added in v1.1.8

func (r *RedisConfig) String() string

type RoundRobinPolicy

type RoundRobinPolicy struct {
	// contains filtered or unexported fields
}

func (*RoundRobinPolicy) Resolve

func (r *RoundRobinPolicy) Resolve(connPools []gorm.ConnPool) gorm.ConnPool

Jump to

Keyboard shortcuts

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