context

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: May 27, 2018 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Version .
	Version = "0.2.0"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Context

type Context struct {
	Config   *config.ConfigStruct
	Database databaseinterface.Interface
	Echo     *echo.Echo
	Flagger  *flagger.Flagger
	Logger   zerolog.Logger
}

Context is a some sort of singleton. Basically it's a structure that initialized once and then passed to all parts of application. It contains everything every part of application need, like configuration access, logger, etc.

func New

func New() *Context

New creates new context.

func (*Context) Initialize

func (c *Context) Initialize()

Initialize initializes context.

func (*Context) LoadConfiguration

func (c *Context) LoadConfiguration()

LoadConfiguration loads configuration and executes right after Flagger have parsed CLI flags, because it depends on "-config" defined in Initialize().

func (*Context) RegisterDatabaseInterface

func (c *Context) RegisterDatabaseInterface(di databaseinterface.Interface)

RegisterDatabaseInterface registers database interface for later use.

func (*Context) RegisterEcho

func (c *Context) RegisterEcho(e *echo.Echo)

RegisterEcho registers Echo instance for later usage.

func (*Context) Shutdown

func (c *Context) Shutdown()

Shutdown shutdowns entire application.

Jump to

Keyboard shortcuts

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