store Package
Last updated
This page lists the
core/store functions for opening a store, writing values, and reading or scanning keys.Lifecycle and Sessions
- func New(dir string, apiKey ...string) (*Store, error)
- func (s *Store) Session() *Session
- func (s *Store) Close() error
Store and Session both embed the unexported core, so every method below is available on both.- func (c *core) Current() int
- func (c *core) Select(index int) error
- func (c *core) HasEmbedder() bool
- func (c *core) Exec(input string) string
- func (c *core) DB() *db
DB returns the currently selected database, replaying it from disk on first use; its type is unexported, so outside the package the result is only an opaque handle.Writes
- type SetFlag int
- const (
- SetDefault SetFlag = iota
- SetNX
- SetXX
- )
- func (c *core) Set(key, value string, flag SetFlag, expireAt *int64) error
- func (c *core) SetVector(ctx context.Context, key, value string, flag SetFlag, expireAt *int64) error
- func (c *core) SetField(key string, subKeys []string, value string, flag SetFlag, expireAt *int64) error
- func (c *core) Incr(key string, delta float64) (float64, error)
- func (c *core) IncrField(key string, subKeys []string, delta float64) (float64, error)
- func (c *core) Del(keys ...string) int
- func (c *core) DelField(key string, subKeys []string) error
Reads and Scans
- func (c *core) Get(key string) (*Entry, bool)
- func (c *core) GetField(key string, subKeys []string) (string, bool)
- func (c *core) Exist(key string) string
- func (c *core) ExistField(key string, subKeys []string) string
- func (c *core) Type(key string) string
- func (c *core) TypeField(key string, subKeys []string) string
- func (c *core) Keys(pattern string) []string
- func (c *core) Find(op filter.Operator, value string, limit int) []string
- func (c *core) Query(f filter.Filter, limit int) []string
Exist, ExistField, Type, and TypeField return the REPL text forms. Query returns key: value strings. limit <= 0 means no limit.