cfgbackend

package
v0.82.0 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2023 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

Package configuration defines the Source 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 ConsulSource

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

func NewConsulSource

func NewConsulSource(uri string) (cc *ConsulSource, err error)

func (*ConsulSource) Exists

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

func (*ConsulSource) Get

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

func (*ConsulSource) GetKeysByPrefix

func (cc *ConsulSource) GetKeysByPrefix(keyPrefix string) (keys []string, err error)

func (*ConsulSource) GetNextUInt32

func (cc *ConsulSource) GetNextUInt32(key string) (value uint32, err error)

func (*ConsulSource) GetRecursive

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

func (*ConsulSource) GetRecursiveYaml

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

func (*ConsulSource) GetWithLastIndex added in v0.29.2

func (cc *ConsulSource) GetWithLastIndex(key string) (value string, lastIndex uint64, err error)

func (*ConsulSource) IsDir

func (cc *ConsulSource) IsDir(key string) (isDir bool)

func (*ConsulSource) Put

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

func (*ConsulSource) PutRecursive

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

func (*ConsulSource) PutRecursiveYaml

func (cc *ConsulSource) 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 ROSource

type ROSource interface {
	Get(string) (string, error)
	GetKeysByPrefix(string) ([]string, error)
	GetRecursive(string) (Item, error)
	GetRecursiveYaml(string) ([]byte, error)
	Exists(string) (bool, error)
	IsDir(string) bool
}

type Source

type Source interface {
	ROSource
	Put(string, string) error
	PutRecursive(string, Item) error
	PutRecursiveYaml(string, []byte) error
}

func NewSource

func NewSource(uri string) (configuration Source, err error)

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 YamlSource

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

func (*YamlSource) Exists

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

func (*YamlSource) Get

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

func (*YamlSource) GetKeysByPrefix

func (yc *YamlSource) GetKeysByPrefix(keyPrefix string) (keys []string, err error)

func (*YamlSource) GetRecursive

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

func (*YamlSource) GetRecursiveYaml

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

func (*YamlSource) IsDir

func (yc *YamlSource) IsDir(key string) (isDir bool)

func (*YamlSource) Put

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

func (*YamlSource) PutRecursive

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

func (*YamlSource) PutRecursiveYaml

func (yc *YamlSource) 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