Documentation ¶
Index ¶
- Variables
- func CommonKeyName(key1, key2 Key) string
- type CKey
- func (k *CKey) BaseName() string
- func (k *CKey) Bytes() []byte
- func (k *CKey) Close()
- func (k *CKey) Compare(other Key) int
- func (k *CKey) Duplicate(flags KeyCopyFlags) Key
- func (k *CKey) IsBelow(other Key) bool
- func (k *CKey) IsBelowOrSame(other Key) bool
- func (k *CKey) IsDirectlyBelow(other Key) bool
- func (k *CKey) Meta(name string) string
- func (k *CKey) MetaMap() map[string]string
- func (k *CKey) MetaSlice() []Key
- func (k *CKey) Name() string
- func (k *CKey) Namespace() ElektraNamespace
- func (k *CKey) RemoveMeta(name string) error
- func (k *CKey) SetBoolean(value bool) error
- func (k *CKey) SetBytes(value []byte) error
- func (k *CKey) SetMeta(name, value string) error
- func (k *CKey) SetName(name string) error
- func (k *CKey) SetString(value string) error
- func (k *CKey) String() string
- type CKeySet
- func (ks *CKeySet) Append(other KeySet) int
- func (ks *CKeySet) AppendKey(key Key) int
- func (ks *CKeySet) Clear()
- func (ks *CKeySet) Close()
- func (ks *CKeySet) Copy(keySet KeySet)
- func (ks *CKeySet) Cut(key Key) KeySet
- func (ks *CKeySet) Duplicate() KeySet
- func (ks *CKeySet) ForEach(iterator Iterator)
- func (ks *CKeySet) KeyNames() []string
- func (ks *CKeySet) Len() int
- func (ks *CKeySet) Lookup(key Key) Key
- func (ks *CKeySet) LookupByName(name string) Key
- func (ks *CKeySet) Pop() Key
- func (ks *CKeySet) Remove(key Key) Key
- func (ks *CKeySet) RemoveByName(name string) Key
- func (ks *CKeySet) ToSlice() []Key
- type ElektraError
- type ElektraNamespace
- type Iterator
- type KDB
- type KdbC
- type Key
- type KeyCopyFlags
- type KeySet
Constants ¶
This section is empty.
Variables ¶
var ( ErrResource = errors.New("C01100 - Resource") ErrOutOfMemory = errors.New("C01110 - OutOfMemory") ErrInstallation = errors.New("C01200 - Installation") ErrInternal = errors.New("C01310 - Internal") ErrInterface = errors.New("C01320 - Interface") ErrPluginMisbehavior = errors.New("C01330 - PluginMisbehavior") ErrConflictingState = errors.New("C02000 - ConflictingState") ErrValidationSyntactic = errors.New("C03100 - ValidationSyntactic") ErrValidationSemantic = errors.New("C03200 - ValidationSemantic") )
error codes taken from libelektra/src/error/specification
Functions ¶
func CommonKeyName ¶
CommonKeyName returns the common path of two Keys.
Types ¶
type CKey ¶
type CKey struct {
Ptr *C.struct__Key
}
func (*CKey) BaseName ¶
BaseName returns the basename of the Key. Some examples: - BaseName of system:/some/keyname is keyname - BaseName of "user:/tmp/some key" is "some key"
func (*CKey) Close ¶
func (k *CKey) Close()
Close free's the underlying key's memory. This needs to be done for Keys that are created by NewKey() or Key.Duplicate().
func (*CKey) Compare ¶
Compare the name of two keys. It returns 0 if the keys are equal, < 0 if this key is less than `other` Key and > 0 if this key is greater than `other` Key. This function defines the sorting order of a KeySet.
func (*CKey) Duplicate ¶
func (k *CKey) Duplicate(flags KeyCopyFlags) Key
Duplicate duplicates a Key.
func (*CKey) IsBelowOrSame ¶
IsBelowOrSame checks if this key is below or the same as the `other` key.
func (*CKey) IsDirectlyBelow ¶
IsDirectlyBelow checks if this key is directly below the `other` Key.
func (*CKey) Namespace ¶
func (k *CKey) Namespace() ElektraNamespace
Namespace returns the namespace of a Key.
func (*CKey) RemoveMeta ¶
RemoveMeta deletes a meta Key.
func (*CKey) SetBoolean ¶
SetBoolean sets the string of a key to a boolean where true is represented as "1" and false as "0".
type CKeySet ¶
type CKeySet struct {
Ptr *C.struct__KeySet
}
func (*CKeySet) Append ¶
Append appends all Keys from `other` to this KeySet and returns the new length of this KeySet or -1 if `other` is not a KeySet which was created by elektra/kdb.
func (*CKeySet) AppendKey ¶
AppendKey appends a Key to this KeySet and returns the new length of this KeySet or -1 if the key is not a Key created by elektra/kdb.
func (*CKeySet) Close ¶
func (ks *CKeySet) Close()
Close needs to be called on a KeySet after it is not in use anymore to free the allocated memory.
func (*CKeySet) LookupByName ¶
LookupByName searches the KeySet for a Key by name.
func (*CKeySet) RemoveByName ¶
RemoveByName removes a key by its name from the KeySet and returns it if found.
type ElektraError ¶
type ElektraError struct { Err error Description string Number string Reason string Ingroup string Module string File string Line string }
func (*ElektraError) Error ¶
func (e *ElektraError) Error() string
func (*ElektraError) Unwrap ¶
func (e *ElektraError) Unwrap() error
type ElektraNamespace ¶
type ElektraNamespace uint
const ( KEY_NS_NONE ElektraNamespace = C.KEY_NS_NONE KEY_NS_CASCADING ElektraNamespace = C.KEY_NS_CASCADING KEY_NS_META ElektraNamespace = C.KEY_NS_META KEY_NS_SPEC ElektraNamespace = C.KEY_NS_SPEC KEY_NS_PROC ElektraNamespace = C.KEY_NS_PROC KEY_NS_DIR ElektraNamespace = C.KEY_NS_DIR KEY_NS_USER ElektraNamespace = C.KEY_NS_USER KEY_NS_SYSTEM ElektraNamespace = C.KEY_NS_SYSTEM KEY_NS_DEFAULT ElektraNamespace = C.KEY_NS_DEFAULT )
type KDB ¶
type KDB interface { Open() error Close() error Get(keySet KeySet, parentKey Key) (changed bool, err error) Set(keySet KeySet, parentKey Key) (changed bool, err error) Version() (string, error) }
KDB (key data base) access functions
type KdbC ¶
type KdbC struct {
// contains filtered or unexported fields
}
func (*KdbC) Get ¶
Get retrieves parentKey and all Keys beneath it. Returns true if Keys have been loaded or updated and an error if something went wrong.
func (*KdbC) OpenWithContract ¶
Open creates a handle to the kdb library, this is mandatory to Get / Set Keys. This function also enforces a contract.
type Key ¶
type Key interface { Name() string Namespace() ElektraNamespace BaseName() string String() string Bytes() []byte Close() Meta(name string) string MetaMap() map[string]string RemoveMeta(name string) error MetaSlice() []Key IsBelow(key Key) bool IsBelowOrSame(key Key) bool IsDirectlyBelow(key Key) bool Compare(key Key) int Duplicate(flags KeyCopyFlags) Key SetMeta(name, value string) error SetName(name string) error SetString(value string) error SetBytes(value []byte) error }
Key is the wrapper around the Elektra Key.
type KeyCopyFlags ¶
type KeyCopyFlags uint
const ( KEY_CP_NAME KeyCopyFlags = C.KEY_CP_NAME KEY_CP_VALUE KeyCopyFlags = C.KEY_CP_VALUE KEY_CP_STRING KeyCopyFlags = C.KEY_CP_STRING KEY_CP_META KeyCopyFlags = C.KEY_CP_META KEY_CP_ALL KeyCopyFlags = C.KEY_CP_ALL )
type KeySet ¶
type KeySet interface { Copy(keySet KeySet) Append(keySet KeySet) int AppendKey(key Key) int Remove(key Key) Key RemoveByName(name string) Key Duplicate() KeySet Pop() Key Len() int Cut(key Key) KeySet Close() ForEach(iterator Iterator) ToSlice() []Key KeyNames() []string Clear() Lookup(key Key) Key LookupByName(name string) Key }
KeySet represents a collection of Keys.