hiboot: hidevops.io/hiboot/pkg/app Index | Files | Directories

package app

import "hidevops.io/hiboot/pkg/app"

Package app provides abstract layer for cli/web application

Package app provides hiboot app application interface


Package Files

application.go autoconfigure.go doc.go postprocessor.go properties.go


const (
    // ApplicationContextName is the application context instance name
    ApplicationContextName      = "app.applicationContext"
    ContextPathFormat           = "server.context_path_format"
    ContextPathFormatKebab      = "kebab"
    ContextPathFormatSnake      = "snake"
    ContextPathFormatCamel      = "camel"
    ContextPathFormatLowerCamel = "lower-camel"
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"

    // Version is the property key of app.version
    Version = "app.version"


var AutoConfiguration = Register

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

var Component = Register

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

var (

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

func Register Uses

func Register(params ...interface{})

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

func RegisterPostProcessor Uses

func RegisterPostProcessor(p ...interface{})

RegisterPostProcessor register post processor

type Application Uses

type Application interface {
    Initialize() error
    // TODO: remove it from factory as system.build can be injected directly
    SetProperty(name string, value ...interface{}) Application
    GetProperty(name string) (value interface{}, ok bool)
    SetAddCommandLineProperties(enabled bool) Application

Application is the base application interface

type ApplicationContext Uses

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 Uses

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

BaseApplication is the base application

func (*BaseApplication) AfterInitialization Uses

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

AfterInitialization post initialization

func (*BaseApplication) Build Uses

func (a *BaseApplication) Build()

Initialize init application

func (*BaseApplication) BuildConfigurations Uses

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

BuildConfigurations get BuildConfigurations

func (*BaseApplication) ConfigurableFactory Uses

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

ConfigurableFactory get ConfigurableFactory

func (*BaseApplication) GetInstance Uses

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

GetInstance get application instance by name

func (*BaseApplication) GetProperty Uses

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

GetProperty get application property

func (*BaseApplication) Initialize Uses

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

Initialize init application

func (*BaseApplication) PrintStartupMessages Uses

func (a *BaseApplication) PrintStartupMessages()

PrintStartupMessages prints startup messages

func (*BaseApplication) RegisterController Uses

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

RegisterController register controller by interface

func (*BaseApplication) Run Uses

func (a *BaseApplication) Run()

Run run the application

func (*BaseApplication) SetAddCommandLineProperties Uses

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

SetAddCommandLineProperties set add command line properties to be enabled or disabled

func (*BaseApplication) SetProperty Uses

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

SetProperty set application property should be able to set property from source code by SetProperty, it can be override by program argument, e.g. myapp --app.profiles.active=dev

func (*BaseApplication) SystemConfig Uses

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

SystemConfig returns application config

func (*BaseApplication) Use Uses

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

Use use middleware handlers

type Configuration Uses

type Configuration struct {
    RuntimeDeps factory.Deps

Configuration is the base configuration

type PostProcessor Uses

type PostProcessor interface {

PostProcessor is the post processor


cliPackage cli provides quick start framework for command line application.
fakePackage fake provides fake.ApplicationContext for unit testing
webPackage web provides quick start framework for web application.

Package app imports 15 packages (graph) and is imported by 45 packages. Updated 2019-10-15. Refresh now. Tools for package owners.