provider

package
v1.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 27, 2021 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MsgMissingProvider = "provider '%s' required"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type GenericProvider

type GenericProvider interface {
	Close() error
}

FIXME implement this

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) Find

func (p *Provider) Find(providerType ProviderType) (interface{}, bool)

Find returns the registered provider instance if it is 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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL