fileprovider

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FileProvider

type FileProvider struct {
	// contains filtered or unexported fields
}

FileProvider loads config from a file.

func NewFileProvider

func NewFileProvider(options ...FileProviderOption) *FileProvider

NewFileProvider creates a new file provider with the specified options.

func (*FileProvider) LoadConfig

func (p *FileProvider) LoadConfig(currentConfig map[string]iface.ConfigValue) (map[string]iface.ConfigValue, error)

LoadConfig loads configuration for FileProvider

type FileProviderOption

type FileProviderOption func(p *FileProvider)

FileProviderOption is used to control the behavior of FileProvider

func WithFileProviderItemFactory

func WithFileProviderItemFactory(itemFactory *ItemFactory) FileProviderOption

WithFileProviderItemFactory returns a FileProviderOption that sets the ItemFactory.

func WithFileProviderLogger

func WithFileProviderLogger(logger iface.LogFunc) FileProviderOption

WithFileProviderLogger sets the logger implementation for the file provider option.

func WithFileProviderPath

func WithFileProviderPath(filepath string) FileProviderOption

WithFileProviderPath sets the file path for the file provider option.

func WithLogLimiter

func WithLogLimiter(limiter iface.Limiter) FileProviderOption

WithLogLimiter returns a FileProviderOption that sets the log limiter.

type ItemFactory

type ItemFactory struct {
	// contains filtered or unexported fields
}

ItemFactory holds a map of item initializers with iface.ItemType as keys.

func NewItemFactory

func NewItemFactory(given map[iface.ItemType]iface.ItemInitializer) *ItemFactory

NewItemFactory returns a new ItemFactory with a given map of item initializers.

func (*ItemFactory) NewItem

func (f *ItemFactory) NewItem(itemType iface.ItemType, js []byte) (iface.ConfigValueItem, error)

NewItem returns a new instance of iface.ConfigValueItem with the given item type and json bytes.

func (*ItemFactory) RegisterInitializer

func (f *ItemFactory) RegisterInitializer(itemType iface.ItemType, initializer iface.ItemInitializer) *ItemFactory

RegisterInitializer registers an item initializer with the given item type.

Jump to

Keyboard shortcuts

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