module

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2022 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IModule

type IModule interface {
	Name() string
	Version() string
	Export(string) (any, bool)
}

type Module

type Module struct {
	ModuleName    string
	ModuleVersion string
	ModuleConfig  *viper.Viper
	ModuleDepends []string       // depend modules
	ModuleEnv     map[string]any // unexported functions or variables, only accessible to system
	ModuleExport  map[string]any // exported functions or variables, accessible to all modules
	ModuleRoute   string         // route prefix
	ModulePerm    map[string]string
	EntryPoint    func(mctx *ModuleContext)
}

func (*Module) Export

func (m *Module) Export(name string) (any, bool)

func (*Module) Name

func (m *Module) Name() string

func (*Module) Version

func (m *Module) Version() string

type ModuleContext

type ModuleContext struct {
	*Server
	Route   iris.Party
	Storage storage.IStorage
	Cache   cache.ICache
}

type Registry

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

func NewRegistry

func NewRegistry(server *Server) *Registry

func (*Registry) Get

func (r *Registry) Get(moduleName string) IModule

func (*Registry) Register

func (r *Registry) Register(module ...*Module)

type Server

type Server struct {
	Validator *validator.Validate
	Logger    *golog.Logger
	Scheduler *gocron.Scheduler
	Database  *gorm.DB
	EventBus  *emitter.Emitter
	Registry  *Registry
}

Jump to

Keyboard shortcuts

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