module

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2020 License: BSD-2-Clause Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func List

func List() (m []string)

List returns all available modules names.

func Register

func Register(name string, newFactory func() Factory)

Register registers a new Module Factory. If a Module Factory already exists for the supplied name, it will be replaced.

Types

type Config

type Config struct {
	Factory
}

Config represents a module configuration.

func (*Config) UnmarshalJSON

func (c *Config) UnmarshalJSON(data []byte) error

UnmarshalJSON implements JSON interface to customize JSON unmarshalling process. It detects the module name (field: Module) and generates the appropriate module's constructor.

func (*Config) UnmarshalYAML

func (c *Config) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements YAML interface to customize JSON unmarshalling process. It detects the module name (field: Module) and generates the appropriate module's constructor.

type Environment

type Environment struct {
	// Logger provides logging facility to a module.
	Logger *log.Logger
	// Store provides a collection's access facilities to a module.
	Store *store.Store
}

Environment represents a set of facilities that a module can access to to interact with its environment (logging, gostore access, ...).

type Factory

type Factory interface {
	// NewModule creates a new module according to Factory configuration and to
	// gostore's modules environment.
	NewModule(*Environment) (Module, error)
}

Factory represents a module provider.

type Module

type Module interface {
	// Process performs an action on a collection's record
	Process(*store.Record) error
}

Module represents a gostore's module that can act on collection's records.

func New

func New(cfg *Config, env *Environment) (Module, error)

New creates a new Module.

Directories

Path Synopsis
Package all eases import of all available module in the main application.
Package all eases import of all available module in the main application.

Jump to

Keyboard shortcuts

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