configuration

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2019 License: GPL-3.0 Imports: 9 Imported by: 2

Documentation

Overview

Package configuration defines the Configuration interface as the main access point to O² Configuration backends. Consul and YAML backends are also provided.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Array

type Array []Item

func (Array) Array

func (m Array) Array() Array

func (Array) DeepCopy

func (m Array) DeepCopy() Item

func (Array) Map

func (m Array) Map() Map

func (Array) Type

func (m Array) Type() ItemType

func (Array) Value

func (m Array) Value() string

type Configuration

type Configuration interface {
	Get(string) (string, error)
	GetRecursive(string) (Item, error)
	GetRecursiveYaml(string) ([]byte, error)
	Put(string, string) error
	PutRecursive(string, Item) error
	PutRecursiveYaml(string, []byte) error
	Exists(string) (bool, error)
}

func NewConfiguration

func NewConfiguration(uri string) (configuration Configuration, err error)

type ConsulConfiguration

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

func (*ConsulConfiguration) Exists

func (cc *ConsulConfiguration) Exists(key string) (exists bool, err error)

func (*ConsulConfiguration) Get

func (cc *ConsulConfiguration) Get(key string) (value string, err error)

func (*ConsulConfiguration) GetRecursive

func (cc *ConsulConfiguration) GetRecursive(key string) (value Item, err error)

func (*ConsulConfiguration) GetRecursiveYaml

func (cc *ConsulConfiguration) GetRecursiveYaml(key string) (value []byte, err error)

func (*ConsulConfiguration) Put

func (cc *ConsulConfiguration) Put(key string, value string) (err error)

func (*ConsulConfiguration) PutRecursive

func (cc *ConsulConfiguration) PutRecursive(string, Item) error

func (*ConsulConfiguration) PutRecursiveYaml

func (cc *ConsulConfiguration) PutRecursiveYaml(string, []byte) error

type Item

type Item interface {
	Type() ItemType
	Value() string
	Map() Map
	Array() Array
	DeepCopy() Item
}

type ItemType

type ItemType int
const (
	IT_Value ItemType = iota
	IT_Map
	IT_Array
)

type Map

type Map map[string]Item

func (Map) Array

func (m Map) Array() Array

func (Map) DeepCopy

func (m Map) DeepCopy() Item

func (Map) Map

func (m Map) Map() Map

func (Map) Type

func (m Map) Type() ItemType

func (Map) Value

func (m Map) Value() string

type String

type String string

func (String) Array

func (s String) Array() Array

func (String) DeepCopy

func (s String) DeepCopy() Item

func (String) Map

func (s String) Map() Map

func (String) Type

func (s String) Type() ItemType

func (String) Value

func (s String) Value() string

type YamlConfiguration

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

func (*YamlConfiguration) Exists

func (yc *YamlConfiguration) Exists(key string) (exists bool, err error)

func (*YamlConfiguration) Get

func (yc *YamlConfiguration) Get(key string) (value string, err error)

func (*YamlConfiguration) GetRecursive

func (yc *YamlConfiguration) GetRecursive(key string) (value Item, err error)

func (*YamlConfiguration) GetRecursiveYaml

func (yc *YamlConfiguration) GetRecursiveYaml(key string) (value []byte, err error)

func (*YamlConfiguration) Put

func (yc *YamlConfiguration) Put(key string, value string) (err error)

func (*YamlConfiguration) PutRecursive

func (yc *YamlConfiguration) PutRecursive(key string, value Item) (err error)

func (*YamlConfiguration) PutRecursiveYaml

func (yc *YamlConfiguration) PutRecursiveYaml(key string, value []byte) (err error)

Jump to

Keyboard shortcuts

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