module

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2024 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Meta

type Meta struct {
	Name         string
	Provides     []any
	Invokes      []any
	ProvideHooks []ProvideHook
	Depends      []string
}

Meta is the meta data of a module

type Module

type Module struct {
	// contains filtered or unexported fields
}

Module represents a group of provide and invoke functions. It makes it possible to group functionalities with modules. These functionalities can be imported whenever needed

func New

func New(name ...string) *Module

func (*Module) AddAsser

func (m *Module) AddAsser(assers ...as.Asser) *Module

AddAsser adds provide hook from as.Asser instances

func (*Module) AddProvideHook

func (m *Module) AddProvideHook(hooks ...ProvideHook) *Module

AddProvideHook adds provide hook

func (*Module) Invoke

func (m *Module) Invoke(ctr ...any) *Module

Invoke add functions to invoke pool

func (*Module) Merge

func (m *Module) Merge(sub ...*SubModule) *Module

Merge combine sub module providers into module providers

func (*Module) Meta

func (m *Module) Meta(usedModules ...string) Meta

Meta returns meta data of the module

func (*Module) Name

func (m *Module) Name() string

Name returns name of the module

func (*Module) Provide

func (m *Module) Provide(ctr ...any) *Module

Provide add constructors to provide pool

type ProvideHook

type ProvideHook struct {
	Match func(ctr any) bool
	Wrap  func(ctr any) any
}

ProvideHook represents a pre-Provide step so that constructors can be manipulated or grouped

type SubModule

type SubModule struct {
	// contains filtered or unexported fields
}

SubModule represents a simple provide pool partition of a module can not be used as a standalone module with chaki. It has to be merged with another module with

func NewSubModule

func NewSubModule() *SubModule

func (*SubModule) AddAsser

func (sm *SubModule) AddAsser(assers ...as.Asser) *SubModule

func (*SubModule) AddProvideHook

func (sm *SubModule) AddProvideHook(hooks ...ProvideHook) *SubModule

func (*SubModule) Provide

func (sm *SubModule) Provide(provide ...any) *SubModule

Provide add constructor to provide pool

Jump to

Keyboard shortcuts

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