Documentation
¶
Index ¶
- Constants
- Variables
- func AddComponent(name string, constructor any, opts ...ComponentOption)
- func AppName(name string) utils.OptionFunc[InitOption]
- func CryptoConfigName(name string) utils.OptionFunc[cryptoConfigOption]
- func CryptoConstruct(ctx context.Context, c CryptoConf, _ ...utils.OptionExtender) func()
- func CryptoDecryptByTag(data any, opts ...utils.OptionExtender)
- func CryptoDecryptFunc(opts ...utils.OptionExtender) func(src string) (dst string)
- func CryptoEncryptFunc(opts ...utils.OptionExtender) func(src string) (dst string)
- func Ctx(ctx context.Context) utils.OptionFunc[initOption]
- func DI(di di.DI) utils.OptionFunc[InitOption]
- func Debug() utils.OptionFunc[initOption]
- func Files(filenames []string) utils.OptionFunc[initOption]
- func Loader(fn func(any, ...utils.OptionExtender)) utils.OptionFunc[initOption]
- func NewDefaultLoader(files ...string) *loader
- type Component
- type ComponentOption
- type Configurable
- type CryptoConf
- type InitOption
Constants ¶
View Source
const ( ComponentApp = "App" ComponentDebug = "Debug" ComponentCrypto = "Crypto" ComponentMetrics = "Metrics" ComponentLog = "Log" ComponentDB = "DB" ComponentRedis = "Redis" ComponentMongo = "Mongo" ComponentI18n = "I18n" ComponentLock = "Lock" ComponentMessageQueue = "MQ" ComponentHttp = "Http" ComponentCache = "Cache" ComponentCron = "Cron" ComponentAsync = "Async" ComponentGoroutinePool = "GoroutinePool" )
common component names
View Source
const (
DefaultInstanceKey = "default"
)
Variables ¶
Functions ¶
func AddComponent ¶
func AddComponent(name string, constructor any, opts ...ComponentOption)
func AppName ¶
func AppName(name string) utils.OptionFunc[InitOption]
func CryptoConfigName ¶
func CryptoConfigName(name string) utils.OptionFunc[cryptoConfigOption]
func CryptoConstruct ¶
func CryptoConstruct(ctx context.Context, c CryptoConf, _ ...utils.OptionExtender) func()
func CryptoDecryptByTag ¶
func CryptoDecryptByTag(data any, opts ...utils.OptionExtender)
func CryptoDecryptFunc ¶
func CryptoDecryptFunc(opts ...utils.OptionExtender) func(src string) (dst string)
func CryptoEncryptFunc ¶
func CryptoEncryptFunc(opts ...utils.OptionExtender) func(src string) (dst string)
func DI ¶
func DI(di di.DI) utils.OptionFunc[InitOption]
func Debug ¶
func Debug() utils.OptionFunc[initOption]
func Files ¶
func Files(filenames []string) utils.OptionFunc[initOption]
func Loader ¶
func Loader(fn func(any, ...utils.OptionExtender)) utils.OptionFunc[initOption]
func NewDefaultLoader ¶
func NewDefaultLoader(files ...string) *loader
NewDefaultLoader front files overwrite the backs
Types ¶
type ComponentOption ¶
type ComponentOption func(*options)
func WithCore ¶
func WithCore() ComponentOption
WithCore mark component as core component, they must be init first
func WithFlag ¶ added in v0.0.64
func WithFlag(flagValue *string) ComponentOption
type Configurable ¶
type Configurable interface { Init(businessConfig any, opts ...utils.OptionExtender) (gracefully func()) LoadComponentConfig(name string, componentConfig any) (err error) GetAllConfigs() any Debug() (debug bool) AppName() (name string) DI() di.DI }
func New ¶
func New(appName string) Configurable
func Use ¶
func Use(appName string, opts ...utils.OptionExtender) Configurable
type CryptoConf ¶
type CryptoConf struct { Config *cryptoConf `yaml:"config" json:"config" toml:"config"` Custom map[string]*cryptoConf `yaml:"custom" json:"custom" toml:"custom"` }
func (*CryptoConf) ToOptionMap ¶
func (c *CryptoConf) ToOptionMap() (result map[string][]utils.OptionExtender)
type InitOption ¶
Click to show internal directories.
Click to hide internal directories.