Documentation ¶
Index ¶
- type ChainedProvider
- type ConfiguredProvider
- type MappedProvider
- func (provider *MappedProvider[Value]) Add(key string, value Value)
- func (provider *MappedProvider[Value]) Get(ctx context.Context, key string) (v Value, err error)
- func (provider *MappedProvider[Value]) Has(ctx context.Context, key string) bool
- func (provider *MappedProvider[Value]) Keys(ctx context.Context) (keys []string)
- type NoopProvider
- type Providable
- type Provider
- type SingletonProvider
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChainedProvider ¶
type ChainedProvider[Value Providable] struct { Providers []Provider[Value] }
ChainedProvider tries multiple different providers when trying to retrieve a certain value.
func (*ChainedProvider[Value]) Get ¶
func (c *ChainedProvider[Value]) Get(ctx context.Context, key string) (v Value, err error)
type ConfiguredProvider ¶
type ConfiguredProvider[Value Providable] struct { // contains filtered or unexported fields }
ConfiguredProvider prevents access to certain values based on a passed in block-list of types. It appears as if the disabled types are not installed.
func (*ConfiguredProvider[Value]) Get ¶
func (c *ConfiguredProvider[Value]) Get(ctx context.Context, key string) (v Value, err error)
type MappedProvider ¶
type MappedProvider[Value Providable] struct { // contains filtered or unexported fields }
A MappedProvider is a Provider that stores the providables in a simple map, and caches permanently the results of checking installation status
func NewMappedProvider ¶
func NewMappedProvider[Value Providable](providables map[string]Value) *MappedProvider[Value]
func (*MappedProvider[Value]) Add ¶
func (provider *MappedProvider[Value]) Add(key string, value Value)
func (*MappedProvider[Value]) Get ¶
func (provider *MappedProvider[Value]) Get(ctx context.Context, key string) (v Value, err error)
Get implements Provider
type NoopProvider ¶
type NoopProvider[Value Providable] struct { // contains filtered or unexported fields }
A NoopProvider is a provider that always returns a noop providable regardless of the key
func (*NoopProvider[Value]) Get ¶
func (p *NoopProvider[Value]) Get(ctx context.Context, key string) (v Value, err error)
Get implements Provider
type Providable ¶
A Providable is something that a Provider can check for installation status
type Provider ¶
type Provider[Value Providable] interface { // Get returns the object with the given key Get(context.Context, string) (Value, error) // Has returns true if the provider can provide the object with the given key Has(context.Context, string) bool // Keys returns the keys of the objects that the provider can provide Keys(context.Context) []string }
A Provider is an object which is configured to provide certain objects and will check their installation status before providing them
func NewConfiguredProvider ¶
func NewConfiguredProvider[Value Providable](inner Provider[Value], disabled []string) Provider[Value]
func NewNoopProvider ¶
func NewNoopProvider[Value Providable](providable Value) Provider[Value]
func NewSingletonProvider ¶
func NewSingletonProvider[Value Providable](key string, providable Value) Provider[Value]
type SingletonProvider ¶
type SingletonProvider[Value Providable] struct { // contains filtered or unexported fields }
A SingletonProvider is a provider that always returns a singleton providable
func (*SingletonProvider[Value]) Get ¶
func (p *SingletonProvider[Value]) Get(ctx context.Context, key string) (v Value, err error)
Get implements Provider