Versions in this module Expand all Collapse all v1 v1.0.4 Jul 20, 2023 v1.0.2 Jul 20, 2023 Changes in this version + const CheckError + const MaxConfigFileSize + const ParseError + const ReloadCheckError + const ReloadParseError + var ConfigSizeTooLargeError = fmt.Errorf("配置文件大小过大,超过限定大小(%s)", ...) + var TypeJson = Type + var TypeUnknown = Type + var TypeYaml = Type + func Handle(c any) error + func HandleDefault(c any) error + func HandleWith(c C) (C, error) + func LoggerErrorCallback(logger *log.Logger) func(err *Error) + func MustHandleWith(c C) C + func PostHandle(c any) error + func PreHandle(c any) error + type ConfigReloadChecker func(oc, nc *C) error + type Context struct + func NewContext(newConfig func() *C, options ...Option[C]) *Context[C] + func (c *Context[C]) Config() *C + func (c *Context[C]) InitConfig() error + func (c *Context[C]) RegisterConfigReloadChecker(checker ConfigReloadChecker[C]) uint64 + func (c *Context[C]) RegisterConfigReloadedCallback(callback OnConfigReloaded[C]) uint64 + func (c *Context[C]) ReloadConfig() error + func (c *Context[C]) UnregisterConfigReloadChecker(id uint64) + func (c *Context[C]) UnregisterConfigReloadedCallback(id uint64) + type Error struct + Err error + Type ErrorType + func (e Error) Error() string + type ErrorType int + func (t ErrorType) Type() string + type OnConfigReloaded func(oc, nc *C) + type Option option.CustomOption[*Context[C]] + func AddBytes(bs []byte, typ Type) Option[C] + func AddFile(path string, typ *Type) Option[C] + func AddFilePrefix(prefix string, types ...Type) Option[C] + func ErrorCallback(callback func(err *Error)) Option[C] + func SetBytes(bs []byte, typ Type) Option[C] + func SetFile(path string, typ *Type) Option[C] + func SetFilePrefix(prefix string, types ...Type) Option[C] + type Parser struct + func (p *Parser) AddBytes(bs []byte, typ Type) + func (p *Parser) AddFile(path string, typ *Type) + func (p *Parser) AddFilePrefix(prefix string, types ...Type) + func (p *Parser) SetBytes(bs []byte, typ Type) + func (p *Parser) SetFile(path string, typ *Type) + func (p *Parser) SetFilePrefix(prefix string, types ...Type) + func (p *Parser) Unmarshal(c interface{}) error + type PostHandleAfterChildrenConfig interface + PostHandleAfterChildren func() error + type PostHandlerConfig interface + PostHandle func() error + type PostModifyAfterChildrenConfig interface + PostModifyAfterChildren func() (nc any, modified bool, err error) + type PostModifyConfig interface + PostModify func() (nc any, modified bool, err error) + type PreHandleAfterChildrenConfig interface + PreHandleAfterChildren func() + type PreHandlerConfig interface + PreHandle func() + type PreModifyAfterChildrenConfig interface + PreModifyAfterChildren func() (nc any, modified bool) + type PreModifyConfig interface + PreModify func() (nc any, modified bool) + type Type struct + Id uint64 + Name string + Suffixes []string + Unmarshaler func([]byte, interface{}) error + func NewType(Name string, Suffixes []string, Unmarshaler func([]byte, interface{}) error) Type + func ProbeType(path string) Type