Documentation
¶
Index ¶
Constants ¶
View Source
const ( // ContainerID defines the gapp package container entry id base string. ContainerID = "gapp" // ContainerMiddlewareID defines the default id used to register // the application middleware related services. ContainerMiddlewareID = ContainerID + ".middleware" )
View Source
const ( // Env defines the gapp package environment entry id base string. Env = "GAPP" // EnvMiddleware defines the gapp package middleware environment entry id // base string. EnvMiddleware = Env + "_MIDDLEWARE" )
Variables ¶
This section is empty.
Functions ¶
func EnvBool ¶ added in v1.8.0
EnvBool will try to retrieve a boolean value from the environment variables.
Types ¶
type Application ¶
Application interface used to define the methods of a gapp application.
func NewApplication ¶
func NewApplication(container Container) Application
NewApplication used to instantiate a new application.
type Container ¶
type Container interface {
io.Closer
Has(id string) bool
Remove(id string) error
Service(id string, factory ContainerFactory, tags ...string) error
Factory(id string, factory ContainerFactory, tags ...string) error
Tagged(tag string) ([]interface{}, error)
Get(id string) (interface{}, error)
}
Container is an interface for an object used to lazy load and store instances of registered objects. This is achieved by the registration of factory functions that will instantiate the instances as needed.
type ContainerFactory ¶
type ContainerFactory func() (interface{}, error)
ContainerFactory is a callback function used to instantiate an object used by the application container when a not yet instantiated object is requested.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.