appmod

package module
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2019 License: MIT Imports: 0 Imported by: 1

README

Abstract application module

Build Status Maintainability Test Coverage Go Report Card

Install

go get -u github.com/efureev/appmod

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppModule

type AppModule interface {
	SetConfig(config AppModuleConfig)
	Config() AppModuleConfig

	Init() error
	Destroy() error

	BeforeStart(fn func(mod AppModule) error)
	//AfterStart(func(arg ...interface{})) error
	BeforeDestroy(fn func(mod AppModule) error)
}

AppModule interface

type AppModuleConfig

type AppModuleConfig interface {
	Name() string
	Version() string
}

AppModuleConfig interface

func DefaultConfig

func DefaultConfig() AppModuleConfig

DefaultConfig return default config

func NewConfig

func NewConfig(name, version string) AppModuleConfig

NewConfig create new basic config

type BaseAppModule

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

BaseAppModule is abstract struct layer

func (*BaseAppModule) BeforeDestroy

func (b *BaseAppModule) BeforeDestroy(fn func(mod AppModule) error)

BeforeDestroy - event triggered run before destroy

func (*BaseAppModule) BeforeStart

func (b *BaseAppModule) BeforeStart(fn func(mod AppModule) error)

BeforeStart - event triggered run before init

func (BaseAppModule) Config

func (b BaseAppModule) Config() AppModuleConfig

Config returns app module config

func (*BaseAppModule) Destroy

func (b *BaseAppModule) Destroy() error

Destroy app module

func (*BaseAppModule) Init

func (b *BaseAppModule) Init() error

Init initialize app module

func (*BaseAppModule) SetConfig

func (b *BaseAppModule) SetConfig(config AppModuleConfig)

SetConfig set config to app module

type Config

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

Config structure

func (Config) Name

func (c Config) Name() string

Name returns app module name

func (Config) Version

func (c Config) Version() string

Version returns app module version

Jump to

Keyboard shortcuts

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