config

package
v0.0.0-...-d6ebf68 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadCfgFromFile

func LoadCfgFromFile(inter types.Any) error

读取程序执行目录的 yml/yaml/toml 配置信息 到 config struct

读取配置信息到内存

Types

type Config

type Config struct {
	// 应用名称
	AppName string
	Server  struct {
		//运行端口号
		Port int
	}
	// 主数据库配置
	Master       Database `bean-gorm:"master"`
	Page         PageConfig
	AnonymousUrl []string
}
var (
	// 系统的默认配置
	DefaultConfig *Config
)

type Database

type Database struct {
	// 主机地址
	Host string
	// 端口号
	Port int
	// 数据库用户名
	UserName string
	// 数据库密码
	Password string
	// 数据库名称
	DbName string
	// 最大空闲连接
	MaxIdle int
	// 最大连接
	MaxOpen int
	LogSql  bool
}

数据库配置

type DbConfig

type DbConfig struct {
	Database *gorm.DB
	DbConfig *Database
}

type DbConfigs

type DbConfigs = []*DbConfig

type InitConfigStruct

type InitConfigStruct struct {
	// 要读取配置文件信息, 必须传递指针
	//
	// 该 struct 必须组合 config.Config
	Config types.Any
	// 要初始化的数据源 集合
	DbConfigs *[]*DbConfig
}

type PageConfig

type PageConfig struct {
	// 默认条数
	Default int
	// 最大条数
	Max int
}

Jump to

Keyboard shortcuts

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