Documentation ¶
Overview ¶
Package stdkiwi implements an API with standard values.
These values include all the values in the package github.com/sdslabs/kiwi/values. It implements all the actions as type-safe functions.
Get Started ¶
Create a store, add key and play with it. It's that easy!
store := stdkiwi.NewStore() if err := store.AddKey("my_string", "str"); err != nil { // handle error } myString := store.Str("my_string") if err := myString.Update("Hello, World!"); err != nil { // handle error } str, err := myString.Get() if err != nil { // handle error } fmt.Println(str) // Hello, World!
For documentation visit https://kiwi.sdslabs.co/docs/concepts-stdkiwi.html
Index ¶
- type Hash
- func (h *Hash) Get(keys ...string) ([]string, error)
- func (h *Hash) Guard()
- func (h *Hash) GuardE() error
- func (h *Hash) Has(key string) (bool, error)
- func (h *Hash) Insert(key, value string) error
- func (h *Hash) Keys() ([]string, error)
- func (h *Hash) Len() (int, error)
- func (h *Hash) Map() (map[string]string, error)
- func (h *Hash) Remove(elements ...string) error
- type List
- func (l *List) Append(strings ...string) error
- func (l *List) Find(value string) (int, error)
- func (l *List) Get(index int) (string, error)
- func (l *List) Guard()
- func (l *List) GuardE() error
- func (l *List) Len() (int, error)
- func (l *List) Pop(n int) error
- func (l *List) Remove(index int) error
- func (l *List) RemoveS(value string) error
- func (l *List) Set(index int, set string) error
- func (l *List) Slice(start, end int) ([]string, error)
- type Set
- type Store
- type Str
- type Value
- type Zset
- func (z *Zset) Get(element string) (int, error)
- func (z *Zset) Guard()
- func (z *Zset) GuardE() error
- func (z *Zset) Increment(element string, score int) error
- func (z *Zset) Insert(elements ...string) error
- func (z *Zset) Len() (int, error)
- func (z *Zset) PeekMax() (string, error)
- func (z *Zset) PeekMin() (string, error)
- func (z *Zset) Remove(elements ...string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Hash ¶
type Hash struct {
// contains filtered or unexported fields
}
Hash implements methods for hash value type.
type List ¶
type List struct {
// contains filtered or unexported fields
}
List implements methods for list value type.
type Set ¶
type Set struct {
// contains filtered or unexported fields
}
Set implements methods for set value type.
type Store ¶
Store wraps the kiwi.Store and implements various API methods for standard values.
func NewStoreFromSchema ¶
NewStoreFromSchema creates a new std store from schema.
func (*Store) Hash ¶
Hash returns a "Hashmap" with the key set as "key".
This does not verify if the key and value type pair is correct. If this does not work, "Do" will eventually throw an error. To avoid this use "GuardE" method or "Guard" if schema is pre-defined.
func (*Store) List ¶
List returns a "List" with the key set as "key".
This does not verify if the key and value type pair is correct. If this does not work, "Do" will eventually throw an error. To avoid this use "GuardE" method or "Guard" if schema is pre-defined.
func (*Store) Set ¶
Set returns a "Set" with the key set as "key".
This does not verify if the key and value type pair is correct. If this does not work, "Do" will eventually throw an error. To avoid this use "GuardE" method or "Guard" if schema is pre-defined.
func (*Store) Str ¶
Str returns an "Str" with the key set as "key".
This does not verify if the key and value type pair is correct. If this does not work, "Do" will eventually throw an error. To avoid this use "GuardE" method or "Guard" if schema is pre-defined.
type Str ¶
type Str struct {
// contains filtered or unexported fields
}
Str implements methods for str value type.
type Value ¶
type Value interface { // Guard should panic if the key does not correspond to the correct type. Guard() // GuardE is same as guard but does not panic, instead throws an error. GuardE() error }
Value can be used to access the methods for standard value types.
type Zset ¶
type Zset struct {
// contains filtered or unexported fields
}
Zset implements methods for zset value type.