github.com/Aoi-hosizora/ahlib@v1.5.1-0.20230404072829-241b93cf91c7/xmodule/README.md (about)

     1  # xmodule
     2  
     3  ## Dependencies
     4  
     5  + xcolor
     6  + xerror
     7  + (xtesting)
     8  
     9  ## Documents
    10  
    11  ### Types
    12  
    13  + `type ModuleName string`
    14  + `type ModuleContainer struct`
    15  + `type ModuleProvider struct`
    16  + `type LogLevel uint8`
    17  + `type Logger interface`
    18  
    19  ### Variables
    20  
    21  + None
    22  
    23  ### Constants
    24  
    25  + `const LogPrvName LogLevel`
    26  + `const LogPrvType LogLevel`
    27  + `const LogPrvIntf LogLevel`
    28  + `const LogPrv LogLevel`
    29  + `const LogInjField LogLevel`
    30  + `const LogInjFinish LogLevel`
    31  + `const LogAll LogLevel`
    32  + `const LogSilent LogLevel`
    33  
    34  ### Functions
    35  
    36  + `func NewModuleContainer() *ModuleContainer`
    37  + `func NameProvider(name ModuleName, module interface{}) *ModuleProvider`
    38  + `func TypeProvider(module interface{}) *ModuleProvider`
    39  + `func IntfProvider(interfacePtr interface{}, moduleImpl interface{}) *ModuleProvider`
    40  + `func SetLogger(logger Logger)`
    41  + `func ProvideByName(name ModuleName, module interface{})`
    42  + `func ProvideByType(module interface{})`
    43  + `func ProvideByIntf(interfacePtr interface{}, moduleImpl interface{})`
    44  + `func RemoveByName(name ModuleName) (removed bool)`
    45  + `func RemoveByType(module interface{}) (removed bool)`
    46  + `func RemoveByIntf(interfacePtr interface{}) (removed bool)`
    47  + `func GetByName(name ModuleName) (module interface{}, exist bool)`
    48  + `func MustGetByName(name ModuleName) interface{}`
    49  + `func GetByType(moduleType interface{}) (module interface{}, exist bool)`
    50  + `func MustGetByType(moduleType interface{}) interface{}`
    51  + `func GetByIntf(interfacePtr interface{}) (module interface{}, exist bool)`
    52  + `func MustGetByIntf(interfacePtr interface{}) interface{}`
    53  + `func Inject(injectee interface{}) error`
    54  + `func MustInject(injectee interface{})`
    55  + `func AutoProvide(providers ...*ModuleProvider) error`
    56  + `func MustAutoProvide(providers ...*ModuleProvider)`
    57  + `func DefaultLogger(level LogLevel, logPrvFunc func(moduleName, moduleType string), logInjFunc func(moduleName, injecteeType, addition string)) Logger`
    58  
    59  ### Methods
    60  
    61  + `func (m ModuleName) String() string`
    62  + `func (m *ModuleContainer) SetLogger(logger Logger)`
    63  + `func (m *ModuleContainer) ProvideByName(name ModuleName, module interface{})`
    64  + `func (m *ModuleContainer) ProvideByType(module interface{})`
    65  + `func (m *ModuleContainer) ProvideByIntf(interfacePtr interface{}, moduleImpl interface{})`
    66  + `func (m *ModuleContainer) RemoveByName(name ModuleName) (removed bool)`
    67  + `func (m *ModuleContainer) RemoveByType(moduleType interface{}) (removed bool)`
    68  + `func (m *ModuleContainer) RemoveByIntf(interfacePtr interface{}) (removed bool)`
    69  + `func (m *ModuleContainer) GetByName(name ModuleName) (module interface{}, exist bool)`
    70  + `func (m *ModuleContainer) MustGetByName(name ModuleName) interface{}`
    71  + `func (m *ModuleContainer) GetByType(moduleType interface{}) (module interface{}, exist bool)`
    72  + `func (m *ModuleContainer) MustGetByType(moduleType interface{}) interface{}`
    73  + `func (m *ModuleContainer) GetByIntf(interfacePtr interface{}) (module interface{}, exist bool)`
    74  + `func (m *ModuleContainer) MustGetByIntf(interfacePtr interface{}) interface{}`
    75  + `func (m *ModuleContainer) Inject(injectee interface{}) error`
    76  + `func (m *ModuleContainer) MustInject(injectee interface{})`
    77  + `func (m *ModuleContainer) AutoProvide(providers ...*ModuleProvider) error`
    78  + `func (m *ModuleContainer) MustAutoProvide(providers ...*ModuleProvider)`