Documentation
¶
Index ¶
Constants ¶
View Source
const ( MsgMissingProvider = "provider '%s' required" MsgUnsupportedProviderType = "unsupported provider type '%d'" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GenericProvider ¶
type GenericProvider interface {
Close() error
}
type InstanceProviderFunc ¶
type InstanceProviderFunc func() interface{}
type Provider ¶
type Provider struct {
// contains filtered or unexported fields
}
func New ¶
func New(opts ...ProviderConfig) (*Provider, error)
New creates a new provider instance and configures it with provider implementations
func (*Provider) Close ¶ added in v1.4.0
Close iterates over all registered ProviderConfigs and asks them to 'close'
func (*Provider) Find ¶
func (p *Provider) Find(providerType ProviderType) (interface{}, bool)
Find returns the registered provider instance if defined. The bool flag is set to true if there is a provider and false otherwise.
func (*Provider) RegisterProviders ¶
func (p *Provider) RegisterProviders(ignoreExists bool, opts ...ProviderConfig) error
RegisterProviders registers one or more providers. An existing provider will be overwritten if ignoreExists is true, otherwise the function returns an error.
type ProviderConfig ¶
type ProviderConfig struct {
ID string
Type ProviderType
Impl InstanceProviderFunc
}
func WithProvider ¶
func WithProvider(ID string, providerType ProviderType, impl InstanceProviderFunc) ProviderConfig
WithProvider returns a populated ProviderConfig struct.
type ProviderType ¶
type ProviderType int
Click to show internal directories.
Click to hide internal directories.