config

package
v0.0.0-...-83625b3 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2018 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Default = ""
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Collection

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

func NewCollection

func NewCollection() *Collection

func (*Collection) AddProviders

func (c *Collection) AddProviders(providers ...Provider)

func (*Collection) ClearCache

func (c *Collection) ClearCache()

func (*Collection) SetTemporary

func (c *Collection) SetTemporary(temporary bool)

type CollectionLoader

type CollectionLoader interface {
	Load(name string) (*Collection, error)
}

type CollectionLoaderFunc

type CollectionLoaderFunc func(name string) (*Collection, error)

func (CollectionLoaderFunc) Load

func (f CollectionLoaderFunc) Load(name string) (*Collection, error)

type CollectionNotFoundError

type CollectionNotFoundError struct {
	Name string
}

func (CollectionNotFoundError) Error

func (e CollectionNotFoundError) Error() string

type Config

type Config interface {
	Get(key string) (interface{}, error)
}

type ConfigSchemaProvider

type ConfigSchemaProvider interface {
	ConfigSchema() map[string]reflect.Type
}

type DirectoryConfigProvider

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

func NewDirectoryConfigProvider

func NewDirectoryConfigProvider(base string, readOnly bool) *DirectoryConfigProvider

func (*DirectoryConfigProvider) CanSave

func (d *DirectoryConfigProvider) CanSave(key string) bool

func (*DirectoryConfigProvider) Has

func (d *DirectoryConfigProvider) Has(key string) bool

func (*DirectoryConfigProvider) RegisterFiletype

func (d *DirectoryConfigProvider) RegisterFiletype(t FileType)

func (*DirectoryConfigProvider) Save

func (d *DirectoryConfigProvider) Save(key string, v interface{}) error

func (*DirectoryConfigProvider) Unmarshal

func (d *DirectoryConfigProvider) Unmarshal(key string, v interface{}) error

type EnvConfigProvider

type EnvConfigProvider struct {
	Prefix    string
	Separator string
	// contains filtered or unexported fields
}

func NewEnvConfigProvider

func NewEnvConfigProvider() *EnvConfigProvider

func (*EnvConfigProvider) Has

func (e *EnvConfigProvider) Has(key string) bool

func (*EnvConfigProvider) Reset

func (e *EnvConfigProvider) Reset()

func (*EnvConfigProvider) Unmarshal

func (e *EnvConfigProvider) Unmarshal(key string, v interface{}) error

type FileType

type FileType interface {
	Extensions() []string
	Unmarshal(stream io.Reader, v interface{}) error
	Marshal(stream io.Writer, v interface{}) error
}

type JSON

type JSON struct {
	Strict bool
	Prefix string
	Indent string
}

func (*JSON) Extensions

func (t *JSON) Extensions() []string

func (*JSON) Marshal

func (t *JSON) Marshal(stream io.Writer, v interface{}) error

func (*JSON) Unmarshal

func (t *JSON) Unmarshal(stream io.Reader, v interface{}) error

type MemoryConfigProvider

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

func NewMemoryConfigProvider

func NewMemoryConfigProvider() *MemoryConfigProvider

func (*MemoryConfigProvider) CanSave

func (m *MemoryConfigProvider) CanSave(key string) bool

func (*MemoryConfigProvider) Has

func (m *MemoryConfigProvider) Has(key string) bool

func (*MemoryConfigProvider) Reset

func (m *MemoryConfigProvider) Reset()

func (*MemoryConfigProvider) Save

func (m *MemoryConfigProvider) Save(key string, v interface{}) error

func (*MemoryConfigProvider) Unmarshal

func (m *MemoryConfigProvider) Unmarshal(key string, v interface{}) error

type Provider

type Provider interface {
	Has(key string) bool
	Unmarshal(key string, v interface{}) error
}

type Saver

type Saver interface {
	Save(v interface{}) error
}

type Store

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

func NewStore

func NewStore(logger log.Logger) *Store

func (*Store) AddCollection

func (s *Store) AddCollection(namespace string, collection *Collection)

func (*Store) AddCollectionLoaders

func (s *Store) AddCollectionLoaders(cl ...CollectionLoader)

func (*Store) ClearAllCaches

func (s *Store) ClearAllCaches()

func (*Store) Get

func (s *Store) Get(namespace string) Config

func (*Store) GetWritable

func (s *Store) GetWritable(namespace string) WritableConfig

func (*Store) MaybeRegisterSchema

func (s *Store) MaybeRegisterSchema(v interface{})

func (*Store) RegisterSchema

func (s *Store) RegisterSchema(name string, schema reflect.Type)

func (*Store) RemoveTemporary

func (s *Store) RemoveTemporary()

type TOML

type TOML struct {
	ArraysWithOneElementPerLine bool
	QuoteMapKeys                bool
}

func (*TOML) Extensions

func (t *TOML) Extensions() []string

func (*TOML) Marshal

func (t *TOML) Marshal(stream io.Writer, v interface{}) error

func (*TOML) Unmarshal

func (t *TOML) Unmarshal(stream io.Reader, v interface{}) error

type WritableConfig

type WritableConfig interface {
	Config
	GetWritable(key string) (interface{}, Saver, error)
}

type WritableProvider

type WritableProvider interface {
	Provider
	CanSave(key string) bool
	Save(key string, v interface{}) error
}

type XML

type XML struct {
	Strict        bool
	AutoClose     []string
	Entity        map[string]string
	CharsetReader func(charset string, input io.Reader) (io.Reader, error)
	DefaultSpace  string

	Prefix string
	Indent string
}

func (*XML) Extensions

func (t *XML) Extensions() []string

func (*XML) Marshal

func (t *XML) Marshal(stream io.Writer, v interface{}) error

func (*XML) Unmarshal

func (t *XML) Unmarshal(stream io.Reader, v interface{}) error

type YAML

type YAML struct {
	Strict bool
}

func (*YAML) Extensions

func (t *YAML) Extensions() []string

func (*YAML) Marshal

func (t *YAML) Marshal(stream io.Writer, v interface{}) error

func (*YAML) Unmarshal

func (t *YAML) Unmarshal(stream io.Reader, v interface{}) error

Jump to

Keyboard shortcuts

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