kvs

package
v0.9.4 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2024 License: MIT Imports: 4 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadAsBool added in v0.7.5

func LoadAsBool(kvs KVS, k string) (bool, error)

func LoadAsFloat added in v0.7.5

func LoadAsFloat(kvs KVS, k string) (float64, error)

func LoadAsFloatOr added in v0.7.5

func LoadAsFloatOr(kvs KVS, k string, d float64) (float64, error)

func LoadAsInt added in v0.7.5

func LoadAsInt(kvs KVS, k string) (int, error)

func LoadAsIntOr added in v0.7.5

func LoadAsIntOr(kvs KVS, k string, d int) (int, error)

func LoadAsString added in v0.7.5

func LoadAsString(kvs KVS, k string) (string, error)

func LoadAsStringOr added in v0.7.5

func LoadAsStringOr(kvs KVS, k string, d string) (string, error)

func LoadAsUint added in v0.7.5

func LoadAsUint(kvs KVS, k string) (uint, error)

func LoadAsUintOr added in v0.7.5

func LoadAsUintOr(kvs KVS, k string, d uint) (uint, error)

func PLoadAsBool added in v0.8.1

func PLoadAsBool(kvs NoErrKVS, k string) bool

func PLoadAsFloat added in v0.8.1

func PLoadAsFloat(kvs NoErrKVS, k string) float64

func PLoadAsFloatOr added in v0.8.1

func PLoadAsFloatOr(kvs NoErrKVS, k string, d float64) float64

func PLoadAsInt added in v0.8.1

func PLoadAsInt(kvs NoErrKVS, k string) int

func PLoadAsIntOr added in v0.8.1

func PLoadAsIntOr(kvs NoErrKVS, k string, d int) int

func PLoadAsString added in v0.8.1

func PLoadAsString(kvs NoErrKVS, k string) string

func PLoadAsStringOr added in v0.8.1

func PLoadAsStringOr(kvs NoErrKVS, k string, d string) string

func PLoadAsUint added in v0.8.1

func PLoadAsUint(kvs NoErrKVS, k string) uint

func PLoadAsUintOr added in v0.8.1

func PLoadAsUintOr(kvs NoErrKVS, k string, d uint) uint

Types

type Cfg

type Cfg struct {
	Type Type        `yaml:"type" json:"type"`
	Cfg  interface{} `yaml:"cfg"  json:"cfg"`
}

type KVS

type KVS interface {
	plugin.Plugin

	Open() error
	Close() error

	Store(k string, v any) error
	StoreAsString(k string, v any) error
	Load(k string) (any, bool, error)
	LoadOrStore(k string, v any) (any, bool, error)
	LoadAndDelete(k string) (any, bool, error)
	Del(k string) error
	LoadAsBool(k string) (bool, error)
	LoadAsString(k string) (string, error)
	LoadAsStringOr(k string, d string) (string, error)
	LoadAsInt(k string) (int, error)
	LoadAsIntOr(k string, d int) (int, error)
	LoadAsUint(k string) (uint, error)
	LoadAsUintOr(k string, d uint) (uint, error)
	LoadAsFloat(k string) (float64, error)
	LoadAsFloatOr(k string, d float64) (float64, error)
	Collect() (map[string]any, error)
	CollectAsString() (map[string]string, error)
	Range(func(k string, v any) bool) error
}

type MapKVS added in v0.8.1

type MapKVS struct {
	*MapKVSCfg
	// contains filtered or unexported fields
}

func NewMapKVS added in v0.8.1

func NewMapKVS() *MapKVS

func (*MapKVS) Collect added in v0.8.1

func (m *MapKVS) Collect() map[string]any

func (*MapKVS) CollectAsString added in v0.8.1

func (m *MapKVS) CollectAsString() map[string]string

func (*MapKVS) Del added in v0.8.1

func (m *MapKVS) Del(k string)

func (*MapKVS) GetCfg added in v0.8.1

func (m *MapKVS) GetCfg() interface{}

func (*MapKVS) Load added in v0.8.1

func (m *MapKVS) Load(k string) (any, bool)

func (*MapKVS) LoadAndDelete added in v0.8.1

func (m *MapKVS) LoadAndDelete(k string) (any, bool)

func (*MapKVS) LoadAsBool added in v0.8.1

func (m *MapKVS) LoadAsBool(k string) bool

func (*MapKVS) LoadAsFloat added in v0.8.1

func (m *MapKVS) LoadAsFloat(k string) float64

func (*MapKVS) LoadAsFloatOr added in v0.8.1

func (m *MapKVS) LoadAsFloatOr(k string, d float64) float64

func (*MapKVS) LoadAsInt added in v0.8.1

func (m *MapKVS) LoadAsInt(k string) int

func (*MapKVS) LoadAsIntOr added in v0.8.1

func (m *MapKVS) LoadAsIntOr(k string, d int) int

func (*MapKVS) LoadAsString added in v0.8.1

func (m *MapKVS) LoadAsString(k string) string

func (*MapKVS) LoadAsStringOr added in v0.8.1

func (m *MapKVS) LoadAsStringOr(k string, d string) string

func (*MapKVS) LoadAsUint added in v0.8.1

func (m *MapKVS) LoadAsUint(k string) uint

func (*MapKVS) LoadAsUintOr added in v0.8.1

func (m *MapKVS) LoadAsUintOr(k string, d uint) uint

func (*MapKVS) LoadOrStore added in v0.8.1

func (m *MapKVS) LoadOrStore(k string, v any) (any, bool)

func (*MapKVS) Range added in v0.8.1

func (m *MapKVS) Range(f func(k string, v any) bool)

func (*MapKVS) Store added in v0.8.1

func (m *MapKVS) Store(k string, v any)

func (*MapKVS) StoreAsString added in v0.8.1

func (m *MapKVS) StoreAsString(k string, v any)

func (*MapKVS) Type added in v0.8.1

func (m *MapKVS) Type() interface{}

type MapKVSCfg added in v0.8.1

type MapKVSCfg struct{}

func NewMapKVSCfg added in v0.8.1

func NewMapKVSCfg() *MapKVSCfg

type NoErrKVS added in v0.8.1

type NoErrKVS interface {
	plugin.Plugin

	Store(k string, v any)
	StoreAsString(k string, v any)
	Load(k string) (any, bool)
	LoadOrStore(k string, v any) (any, bool)
	LoadAndDelete(k string) (any, bool)
	Del(k string)
	LoadAsBool(k string) bool
	LoadAsString(k string) string
	LoadAsStringOr(k string, d string) string
	LoadAsInt(k string) int
	LoadAsIntOr(k string, d int) int
	LoadAsUint(k string) uint
	LoadAsUintOr(k string, d uint) uint
	LoadAsFloat(k string) float64
	LoadAsFloatOr(k string, d float64) float64
	Collect() map[string]any
	CollectAsString() map[string]string
	Range(func(k string, v any) bool)
}

NoErrKVS ignore KVS method returned error.

type Type

type Type string
const TypeMap Type = "map"

Jump to

Keyboard shortcuts

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