Documentation ¶
Index ¶
- Constants
- Variables
- func GetConfig[T any]() *T
- func Parse(commandLine *pflag.FlagSet)
- func ParseTagSetting(str string, sep string, settings any)
- func Start(conf Config, dao Dao, notinit ...string) func(deferCalls ...func())
- func Unmarshal(v reflect.Value) errordeprecated
- type BasicConfig
- type CloseFunc
- type Config
- type ConfigCenterConfig
- type ConfigTagSettings
- type Dao
- type DaoConfig
- type DaoEntity
- type DaoField
- type DaoFieldCloser
- type DaoFieldCloserWithError
- type DaoTagSettings
- type Env
- type EnvTagSettings
- type FileConfig
- type FlagTagSettings
- type Generate
- type NeedInit
- type NeedInitPlaceholder
Constants ¶
View Source
const ( DEVELOPMENT = "dev" TEST = "test" PRODUCT = "prod" InitKey = "initialize" )
View Source
const ( EntityField = "ENTITY" ConfigField = "CONFIG" )
Variables ¶
View Source
var ( GlobalConfig = &globalConfig{ BasicConfig: BasicConfig{Module: "tiga-app", Env: DEVELOPMENT, ConfUrl: "./config.toml"}, confMap: map[string]interface{}{}, RWMutex: sync.RWMutex{}, } )
约定大于配置
Functions ¶
func ParseTagSetting ¶
ParseTagSetting default sep ;
Types ¶
type BasicConfig ¶
type BasicConfig struct { // 模块名 Module string `flag:"name:mod;short:m;default:;usage:模块名" env:"name:MODULE"` // environment Env string `flag:"name:env;short:e;default:dev;usage:环境" env:"name:ENV"` // 配置文件路径 ConfUrl string `` /* 130-byte string literal not displayed */ // 代理, socks5://localhost:1080 Proxy string `flag:"name:proxy;short:p;default:'socks5://localhost:1080';usage:代理" env:"HTTP_PROXY"` }
BasicConfig zh: 基本配置,包含模块名
type ConfigCenterConfig ¶
type ConfigCenterConfig struct { NoInject []string conf_center.ConfigCenterConfig }
ConfigCenterConfig zh:配置中心的配置 en:
type ConfigTagSettings ¶
func ParseConfigTagSettings
deprecated
func ParseConfigTagSettings(str string) *ConfigTagSettings
Deprecated: 使用独立的tag
type DaoEntity ¶
type DaoFieldCloser ¶
type DaoFieldCloser interface {
Close()
}
type DaoFieldCloserWithError ¶
type DaoTagSettings ¶
func ParseDaoTagSettings ¶
func ParseDaoTagSettings(str string) *DaoTagSettings
type FileConfig ¶
type FileConfig struct { // 模块名 Module string `flag:"name:mod;short:m;default:;usage:模块名" env:"name:MODULE"` Dev, Test, Prod *ConfigCenterConfig }
FileConfig 配置文件映射结构体,每个启动都有一个必要的配置文件,用于初始化基本配置及配置中心配置, ```toml Module = "user"
[dev] configType = "local" Watch = true NoInject = ["Apollo","Etcd", "Es"]
[dev.local] Debug = true ConfigPath = "local.toml" ReloadType = "fsnotify"
[dev.http] Interval = 100 Url = "http://localhost:6666/local.toml"
[dev.nacos] DataId = "pro" Group = "DEFAULT_GROUP"
[[dev.nacos.ServerConfigs]] Scheme = "http" IpAddr = "nacos" Port = 9000 GrpcPort = 10000
[dev.nacos.ClientConfig] NamespaceId = "" username = "nacos" password = "nacos" LogLevel = "debug" ```
type FlagTagSettings ¶
type NeedInitPlaceholder ¶
type NeedInitPlaceholder struct { }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.