app

package
v0.11.2 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2018 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package app provides abstract layer for cli/web application

Package app provides hiboot app application interface

Index

Constants

View Source
const (
	// BannerDisabled is the property that allow use to enable / disable banner display on terminal
	BannerDisabled = "app.banner.disabled"

	// ProfilesInclude is the property that allow user include profiles at runtime
	ProfilesInclude = "app.profiles.include"
)
View Source
const (
	// ApplicationContextName is the application context instance name
	ApplicationContextName = "app.applicationContext"
)

Variables

View Source
var AutoConfiguration = Register

AutoConfiguration register auto configuration struct Deprecated: should use app.Register() instead.

View Source
var Component = Register

Component register all component into container Deprecated: should use app.Register() instead.

View Source
var (

	// ErrInvalidObjectType indicates that configuration type is invalid
	ErrInvalidObjectType = errors.New("[app] invalid Configuration type, one of app.Configuration need to be embedded")
)

Functions

func Register added in v0.9.0

func Register(params ...interface{}) (err error)

Register register a struct instance or constructor (func), so that it will be injectable.

func RegisterPostProcessor

func RegisterPostProcessor(p ...interface{})

RegisterPostProcessor register post processor

Types

type Application

type Application interface {
	Initialize() error
	SetProperty(name string, value ...interface{}) Application
	GetProperty(name string) (value interface{}, ok bool)
	SetAddCommandLineProperties(enabled bool) Application
	Run()
}

Application is the base application interface

type ApplicationContext added in v0.5.4

type ApplicationContext interface {
	RegisterController(controller interface{}) error
	Use(handlers ...context.Handler)
	GetProperty(name string) (value interface{}, ok bool)
	GetInstance(params ...interface{}) (instance interface{})
}

ApplicationContext is the alias interface of Application

type BaseApplication

type BaseApplication struct {
	WorkDir string
	// contains filtered or unexported fields
}

BaseApplication is the base application

func (*BaseApplication) AfterInitialization

func (a *BaseApplication) AfterInitialization(configs ...cmap.ConcurrentMap)

AfterInitialization post initialization

func (*BaseApplication) Build added in v0.9.9

func (a *BaseApplication) Build()

Initialize init application

func (*BaseApplication) BuildConfigurations

func (a *BaseApplication) BuildConfigurations()

BuildConfigurations get BuildConfigurations

func (*BaseApplication) ConfigurableFactory

func (a *BaseApplication) ConfigurableFactory() factory.ConfigurableFactory

ConfigurableFactory get ConfigurableFactory

func (*BaseApplication) GetInstance added in v0.7.1

func (a *BaseApplication) GetInstance(params ...interface{}) (instance interface{})

GetInstance get application instance by name

func (*BaseApplication) GetProperty added in v0.5.8

func (a *BaseApplication) GetProperty(name string) (value interface{}, ok bool)

GetProperty get application property

func (*BaseApplication) Initialize added in v0.6.0

func (a *BaseApplication) Initialize() (err error)

Initialize init application

func (*BaseApplication) PrintStartupMessages added in v0.5.8

func (a *BaseApplication) PrintStartupMessages()

PrintStartupMessages prints startup messages

func (*BaseApplication) RegisterController

func (a *BaseApplication) RegisterController(controller interface{}) error

RegisterController register controller by interface

func (*BaseApplication) Run added in v0.7.1

func (a *BaseApplication) Run()

Run run the application

func (*BaseApplication) SetAddCommandLineProperties added in v0.11.1

func (a *BaseApplication) SetAddCommandLineProperties(enabled bool) Application

SetAddCommandLineProperties set add command line properties to be enabled or disabled

func (*BaseApplication) SetProperty added in v0.5.8

func (a *BaseApplication) SetProperty(name string, value ...interface{}) Application

SetProperty set application property TODO: should set property from source by SetProperty or accept from program argument, e.g. myapp --app.profiles.active=dev

func (*BaseApplication) SystemConfig

func (a *BaseApplication) SystemConfig() *system.Configuration

SystemConfig returns application config

func (*BaseApplication) Use

func (a *BaseApplication) Use(handlers ...context.Handler)

Use use middleware handlers

type Configuration

type Configuration struct {
	at.AutoConfiguration
	RuntimeDeps factory.Deps
}

Configuration is the base configuration

type PostProcessor

type PostProcessor interface {
	AfterInitialization()
}

PostProcessor is the post processor

Directories

Path Synopsis
Package cli provides quick start framework for command line application.
Package cli provides quick start framework for command line application.
Package fake provides fake.ApplicationContext for unit testing
Package fake provides fake.ApplicationContext for unit testing
web
Package web provides quick start framework for web application.
Package web provides quick start framework for web application.

Jump to

Keyboard shortcuts

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