Documentation
¶
Index ¶
- Constants
- func SetInstance(app *Application)
- type Application
- func (app *Application) Bind(abstract string, concrete ConcreteFunc, shared bool)
- func (app *Application) GetProviders() []Provider
- func (app *Application) Make(abstract string) interface{}
- func (app *Application) Register(provider Provider)
- func (app *Application) Resolve(abstract string) interface{}
- func (app *Application) Singleton(abstract string, concrete ConcreteFunc)
- func (app *Application) Version() string
- type ConcreteFunc
- type Provider
- type TestProvider
- type TestService
Constants ¶
View Source
const VERSION = "0.0.1"
VERSION is the current version of the application.
Variables ¶
This section is empty.
Functions ¶
func SetInstance ¶
func SetInstance(app *Application)
Types ¶
type Application ¶
type Application struct {
// contains filtered or unexported fields
}
Application is the main application object.
func App ¶
func App() *Application
func GetInstance ¶
func GetInstance() *Application
func Instance ¶
func Instance() *Application
func NewApplication ¶
func NewApplication(basePath string) *Application
NewApplication creates a new application instance
func (*Application) Bind ¶
func (app *Application) Bind(abstract string, concrete ConcreteFunc, shared bool)
Bind Register a binding with the container.
func (*Application) GetProviders ¶
func (app *Application) GetProviders() []Provider
GetProviders returns all registered providers.
func (*Application) Make ¶
func (app *Application) Make(abstract string) interface{}
Make Resolve the given type from the container.
func (*Application) Register ¶
func (app *Application) Register(provider Provider)
Register registers a provider with the application.
func (*Application) Resolve ¶
func (app *Application) Resolve(abstract string) interface{}
Resolve the given type from the container.
func (*Application) Singleton ¶
func (app *Application) Singleton(abstract string, concrete ConcreteFunc)
Singleton Register a shared binding in the container.
func (*Application) Version ¶
func (app *Application) Version() string
Version returns the current version of the application.
type ConcreteFunc ¶
type ConcreteFunc func(*Application) interface{}
type Provider ¶
type Provider interface {
Register()
}
func NewTestProvider ¶
func NewTestProvider(app *Application) Provider
type TestProvider ¶
type TestProvider struct {
// contains filtered or unexported fields
}
func (*TestProvider) Register ¶
func (p *TestProvider) Register()
type TestService ¶
type TestService struct {
// contains filtered or unexported fields
}
TestService is a test service
func NewTestService ¶
func NewTestService(app *Application) *TestService
func (*TestService) Application ¶
func (s *TestService) Application() *Application
func (*TestService) ReadContent ¶
func (s *TestService) ReadContent() string
func (*TestService) WriteContent ¶
func (s *TestService) WriteContent(content string) *TestService
Click to show internal directories.
Click to hide internal directories.