kvs

package
v0.7.7 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2024 License: MIT Imports: 9 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)

Types

type Cfg

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

type DBModel added in v0.7.5

type DBModel struct {
	RowID     int64
	K         string
	V         string
	UpdatedAt int64
}

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 MemKVS added in v0.7.7

type MemKVS struct {
	*MemKVSCfg
	// contains filtered or unexported fields
}

func NewMemKVS added in v0.7.7

func NewMemKVS() *MemKVS

func (*MemKVS) Close added in v0.7.7

func (i *MemKVS) Close() error

func (*MemKVS) Collect added in v0.7.7

func (i *MemKVS) Collect() (map[string]any, error)

func (*MemKVS) CollectAsString added in v0.7.7

func (i *MemKVS) CollectAsString() (map[string]string, error)

func (*MemKVS) Del added in v0.7.7

func (i *MemKVS) Del(k string) error

func (*MemKVS) GetCfg added in v0.7.7

func (i *MemKVS) GetCfg() interface{}

func (*MemKVS) Load added in v0.7.7

func (i *MemKVS) Load(k string) (any, bool, error)

func (*MemKVS) LoadAndDelete added in v0.7.7

func (i *MemKVS) LoadAndDelete(k string) (any, bool, error)

func (*MemKVS) LoadAsBool added in v0.7.7

func (i *MemKVS) LoadAsBool(k string) (bool, error)

func (*MemKVS) LoadAsFloat added in v0.7.7

func (i *MemKVS) LoadAsFloat(k string) (float64, error)

func (*MemKVS) LoadAsFloatOr added in v0.7.7

func (i *MemKVS) LoadAsFloatOr(k string, d float64) (float64, error)

func (*MemKVS) LoadAsInt added in v0.7.7

func (i *MemKVS) LoadAsInt(k string) (int, error)

func (*MemKVS) LoadAsIntOr added in v0.7.7

func (i *MemKVS) LoadAsIntOr(k string, d int) (int, error)

func (*MemKVS) LoadAsString added in v0.7.7

func (i *MemKVS) LoadAsString(k string) (string, error)

func (*MemKVS) LoadAsStringOr added in v0.7.7

func (i *MemKVS) LoadAsStringOr(k string, d string) (string, error)

func (*MemKVS) LoadAsUint added in v0.7.7

func (i *MemKVS) LoadAsUint(k string) (uint, error)

func (*MemKVS) LoadAsUintOr added in v0.7.7

func (i *MemKVS) LoadAsUintOr(k string, d uint) (uint, error)

func (*MemKVS) LoadOrStore added in v0.7.7

func (i *MemKVS) LoadOrStore(k string, v any) (any, bool, error)

func (*MemKVS) Open added in v0.7.7

func (i *MemKVS) Open() error

func (*MemKVS) Range added in v0.7.7

func (i *MemKVS) Range(f func(k string, v any) bool) error

func (*MemKVS) Store added in v0.7.7

func (i *MemKVS) Store(k string, v any) error

func (*MemKVS) StoreAsString added in v0.7.7

func (i *MemKVS) StoreAsString(k string, v any) error

func (*MemKVS) Type added in v0.7.7

func (i *MemKVS) Type() interface{}

type MemKVSCfg added in v0.7.7

type MemKVSCfg struct{}

func NewMemKVSCfg added in v0.7.7

func NewMemKVSCfg() *MemKVSCfg

type SQLiteKVS added in v0.7.6

type SQLiteKVS struct {
	*SQLiteKVSCfg
	// contains filtered or unexported fields
}

func NewSQLiteKVS added in v0.7.6

func NewSQLiteKVS() *SQLiteKVS

func (*SQLiteKVS) Close added in v0.7.6

func (s *SQLiteKVS) Close() error

func (*SQLiteKVS) Collect added in v0.7.6

func (s *SQLiteKVS) Collect() (map[string]any, error)

func (*SQLiteKVS) CollectAsString added in v0.7.6

func (s *SQLiteKVS) CollectAsString() (map[string]string, error)

func (*SQLiteKVS) Del added in v0.7.6

func (s *SQLiteKVS) Del(k string) error

func (*SQLiteKVS) GetCfg added in v0.7.6

func (s *SQLiteKVS) GetCfg() interface{}

func (*SQLiteKVS) Load added in v0.7.6

func (s *SQLiteKVS) Load(k string) (any, bool, error)

func (*SQLiteKVS) LoadAndDelete added in v0.7.6

func (s *SQLiteKVS) LoadAndDelete(k string) (any, bool, error)

func (*SQLiteKVS) LoadAsBool added in v0.7.6

func (s *SQLiteKVS) LoadAsBool(k string) (bool, error)

func (*SQLiteKVS) LoadAsFloat added in v0.7.6

func (s *SQLiteKVS) LoadAsFloat(k string) (float64, error)

func (*SQLiteKVS) LoadAsFloatOr added in v0.7.6

func (s *SQLiteKVS) LoadAsFloatOr(k string, d float64) (float64, error)

func (*SQLiteKVS) LoadAsInt added in v0.7.6

func (s *SQLiteKVS) LoadAsInt(k string) (int, error)

func (*SQLiteKVS) LoadAsIntOr added in v0.7.6

func (s *SQLiteKVS) LoadAsIntOr(k string, d int) (int, error)

func (*SQLiteKVS) LoadAsString added in v0.7.6

func (s *SQLiteKVS) LoadAsString(k string) (string, error)

func (*SQLiteKVS) LoadAsStringOr added in v0.7.6

func (s *SQLiteKVS) LoadAsStringOr(k string, d string) (string, error)

func (*SQLiteKVS) LoadAsUint added in v0.7.6

func (s *SQLiteKVS) LoadAsUint(k string) (uint, error)

func (*SQLiteKVS) LoadAsUintOr added in v0.7.6

func (s *SQLiteKVS) LoadAsUintOr(k string, d uint) (uint, error)

func (*SQLiteKVS) LoadOrStore added in v0.7.6

func (s *SQLiteKVS) LoadOrStore(k string, v any) (any, bool, error)

func (*SQLiteKVS) Open added in v0.7.6

func (s *SQLiteKVS) Open() error

func (*SQLiteKVS) Range added in v0.7.6

func (s *SQLiteKVS) Range(f func(k string, v any) bool) error

func (*SQLiteKVS) Store added in v0.7.6

func (s *SQLiteKVS) Store(k string, v any) error

func (*SQLiteKVS) StoreAsString added in v0.7.6

func (s *SQLiteKVS) StoreAsString(k string, v any) error

func (*SQLiteKVS) Type added in v0.7.6

func (s *SQLiteKVS) Type() interface{}

type SQLiteKVSCfg added in v0.7.6

type SQLiteKVSCfg struct {
	Path     string `json:"path"     yaml:"path" validate:"required"`
	Table    string `json:"table"    yaml:"table"`
	PoolSize int    `json:"poolSize" yaml:"poolSize"`
}

func NewSQLiteKVSCfg added in v0.7.6

func NewSQLiteKVSCfg() *SQLiteKVSCfg

type Type

type Type string
const TypeMem Type = "mem"
const (
	TypeSQLite Type = "sqlite"
)

Jump to

Keyboard shortcuts

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