Documentation
¶
Index ¶
- Constants
- Variables
- func BuildApps[T Application](builders ModuleFactoryArray) []T
- func ContextFindValue[T any](ctx Context) (T, bool)
- func ContextSetValue[T any](ctx Context, value T)
- func GetInterfaceName[T any]() string
- func HttpMethod(method string) uint16
- func SetEnvironment(e Environment)
- type AppContainerStatus
- type AppInit
- type Application
- type ApplicationContainer
- type ApplicationFactory
- type ApplicationManager
- type CompositionName
- type Context
- type Defaultable
- type Disposable
- type Engine
- type Environment
- type HttpRoute
- type HttpRouteInfo
- type IDefaultableModuleFactory
- type IModuleDependencyProvider
- type IModuleFactory
- type ImplName
- func NewCoreImplName(module, iface, version string) ImplName
- func NewCoreImplNameNoVer(module, iface string) ImplName
- func NewImplName(implType ImplType, module, implementation, version string) ImplName
- func NewImplNameNoVer(implType ImplType, module, iface string) ImplName
- func NewInfraImplName(module, iface, implementation string) ImplName
- func NewInfraImplNameNoVer(module, iface string) ImplName
- func NewModuleImplName(module, iface, implementation string) ImplName
- func NewModuleImplNameNoVer(module, iface string) ImplName
- func NewSceneImplName(module, iface, version string) ImplName
- func NewSceneImplNameNoVer(module, iface string) ImplName
- type ImplType
- type InfraName
- type InitArray
- type LensInit
- type ModuleFactory
- type ModuleFactoryArray
- type ModuleName
- type Named
- type Service
- type Setupable
- type WithContext
Constants ¶
View Source
const ( HttpMethodGet uint16 = 0b1 HttpMethodHead uint16 = 0b10 HttpMethodPost uint16 = 0b100 HttpMethodPut uint16 = 0b1000 HttpMethodPatch uint16 = 0b10000 // RFC 5789 HttpMethodDelete uint16 = 0b100000 HttpMethodConnect uint16 = 0b1000000 HttpMethodOptions uint16 = 0b10000000 HttpMethodTrace uint16 = 0b100000000 )
View Source
const ( ImplTypeCore = ImplType("core") // core type ImplTypeScene = ImplType("scene") // scenario type ImplTypeInfra = ImplType("infra") // infrastructure type ImplTypeComp = ImplType("composite") // composition type ImplTypeModule = ImplType("module") // module type )
View Source
const Version = "0.4.0"
Variables ¶
View Source
var ( AppBuildTime string = "0" AppBuildHash string = "0000000000000000000000000000000000000000" AppBuildVersion string = "v0.0.0" )
View Source
var DEFAULT_ENV string = "development"
DEFAULT_ENV is the environment variable that can be set to "production", "test" or "development" this is the default
Functions ¶
func BuildApps ¶
func BuildApps[T Application](builders ModuleFactoryArray) []T
func ContextFindValue ¶
func ContextSetValue ¶
func GetInterfaceName ¶
func HttpMethod ¶ added in v0.2.10
HttpMethod convert http.Method to uint16 version
func SetEnvironment ¶ added in v0.2.6
func SetEnvironment(e Environment)
Types ¶
type AppContainerStatus ¶
type AppContainerStatus int
const ( AppContainerStatusStopped AppContainerStatus = iota AppContainerStatusRunning AppContainerStatusError )
type AppInit ¶
type AppInit[T Application] func() T
type Application ¶
type Application interface {
Name() ImplName // return scene
}
type ApplicationContainer ¶
type ApplicationFactory ¶
type ApplicationFactory[T Application] interface { Name() string // return factory name Create(app T) error // create application Destroy(app T) error // not used for now }
ApplicationFactory Deprecated: no longer used, keep it for compatibility
type ApplicationManager ¶
type ApplicationManager[T Application] interface { Name() string // return registry name LoadApp(app T) error // load application LoadApps(apps ...T) error // load applications GetApp(appID string) T // return application ListAppNames() []string // return application names ListApps() []T // return list of applications }
ApplicationFactory Deprecated: no longer used, keep it for compatibility
type CompositionName ¶ added in v0.2.6
type CompositionName string
func (CompositionName) ImplName ¶ added in v0.2.6
func (c CompositionName) ImplName(implementation, version string) ImplName
func (CompositionName) ImplNameNoVer ¶ added in v0.2.6
func (c CompositionName) ImplNameNoVer(implementation string) ImplName
func (CompositionName) String ¶ added in v0.2.6
func (c CompositionName) String() string
type Context ¶
Context should be a "context container" that store module's context
func NewContext ¶
func NewContext() Context
type Defaultable ¶ added in v0.2.10
type Defaultable[T any] interface { Default() T }
type Disposable ¶
type Disposable interface {
Dispose() error
}
type Engine ¶
type Engine interface {
Run() error
Start() error
Stop()
ListContainers() []ApplicationContainer
GetContainer(name string) ApplicationContainer
}
type Environment ¶ added in v0.2.6
type Environment uint8
const ( EnvDevelopment Environment = iota EnvProduction EnvTest )
func GetEnvironment ¶ added in v0.2.6
func GetEnvironment() Environment
func (Environment) String ¶ added in v0.2.6
func (e Environment) String() string
type HttpRoute ¶ added in v0.2.7
type HttpRoute interface {
GetRoute() HttpRouteInfo
}
type HttpRouteInfo ¶ added in v0.2.7
type IDefaultableModuleFactory ¶
type IDefaultableModuleFactory[T any] interface { IModuleFactory Defaultable[T] }
type IModuleDependencyProvider ¶
type IModuleDependencyProvider[T any] interface { Provide() T }
type IModuleFactory ¶
type ImplName ¶
func NewCoreImplName ¶
func NewCoreImplNameNoVer ¶
func NewImplName ¶
func NewImplNameNoVer ¶
func NewInfraImplName ¶ added in v0.2.6
func NewInfraImplNameNoVer ¶ added in v0.2.6
func NewModuleImplName ¶ added in v0.2.6
func NewModuleImplNameNoVer ¶ added in v0.2.6
func NewSceneImplName ¶
func NewSceneImplNameNoVer ¶
func (ImplName) EndpointName ¶
func (ImplName) ExportName ¶ added in v0.2.8
ExportName return interface name with capitalized module name
func (ImplName) Identifier ¶
Identifier returns a string identifier of the implementation name.
type InfraName ¶ added in v0.2.6
type InfraName string
func (InfraName) ImplNameNoVer ¶ added in v0.2.6
type InitArray ¶
type InitArray []LensInit
func BuildInitArray ¶
func BuildInitArray(builders ModuleFactoryArray) InitArray
type LensInit ¶
type LensInit func()
LensInit is a function initialize a lens if error happens, it should panic
type ModuleFactory ¶
type ModuleFactory struct {
}
func (ModuleFactory) Apps ¶
func (b ModuleFactory) Apps() []any
func (ModuleFactory) Init ¶
func (b ModuleFactory) Init() LensInit
type ModuleFactoryArray ¶
type ModuleFactoryArray []IModuleFactory
type ModuleName ¶ added in v0.2.6
type ModuleName string
func (ModuleName) ImplName ¶ added in v0.2.6
func (l ModuleName) ImplName(iface, implementation string) ImplName
func (ModuleName) ImplNameNoVer ¶ added in v0.2.6
func (l ModuleName) ImplNameNoVer(implementation string) ImplName
func (ModuleName) String ¶ added in v0.2.6
func (l ModuleName) String() string
func (ModuleName) TableName ¶ added in v0.2.6
func (l ModuleName) TableName(table string) string
type WithContext ¶ added in v0.2.10
Source Files
¶
Click to show internal directories.
Click to hide internal directories.
