24 lines
768 B
Go
24 lines
768 B
Go
package framework
|
|
|
|
// NewInstance defines the function to create a new instance for a service.
|
|
type NewInstance func(...interface{}) (interface{}, error)
|
|
|
|
// ServiceProvider is the interface for a service provider
|
|
type ServiceProvider interface {
|
|
// Register a service into the service container, return a NewInstance constructer
|
|
Register(Container) NewInstance
|
|
|
|
// Init is called when instantiating the service.
|
|
Init(Container) error
|
|
|
|
// InstantiateLater decides if the service is instantiated at register phase.
|
|
// If true, then this service shall be instantiated later.
|
|
InstantiateLater() bool
|
|
|
|
// Params defines the parameters needed to instantiate a service.
|
|
Params(Container) []interface{}
|
|
|
|
// Name is the name of the service provider
|
|
Name() string
|
|
}
|