Documentation
¶
Index ¶
Constants ¶
const ContainerID = "gapp"
ContainerID defines the gapp package container entry id base string.
const Env = "GAPP"
Env defines the gapp package environment entry id base string.
Variables ¶
This section is empty.
Functions ¶
func ErrNilPointer ¶ added in v1.6.0
ErrNilPointer generates a nil pointer argument call error.
func ErrNotFound ¶ added in v1.6.0
ErrNotFound generates an entry not found error.
Types ¶
type Application ¶
Application interface used to define the methods of a gapp application.
func NewApplication ¶
func NewApplication() Application
NewApplication used to instantiate a new application.
type Closable ¶
type Closable interface {
Close()
}
Closable is the interface used to signal the container that the element must be closed on removal.
type Container ¶
type Container interface {
Close()
Has(id string) bool
Service(id string, factory Factory, tags ...string) error
Factory(id string, factory Factory, tags ...string) error
Remove(id string)
Get(id string) (interface{}, error)
Tagged(tag 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 Factory ¶ added in v1.7.0
Factory is a callback function used to instantiate an object used by the application container when a not yet instantiated object is requested.