Documentation ¶
Index ¶
- type StorePostgres
- func (s *StorePostgres) AddValueAsJSON(k string, t string, o interface{}) error
- func (s *StorePostgres) AddValueKV(k string, v string) error
- func (s *StorePostgres) AddValueKVT(k string, v string, t string) error
- func (s *StorePostgres) Close()
- func (s *StorePostgres) CountAll() (int64, string, string)
- func (s *StorePostgres) DeleteAll() error
- func (s *StorePostgres) DeleteAllWithTag(t string) error
- func (s *StorePostgres) DeleteValue(k string) error
- func (s *StorePostgres) DeleteWhereTagLT(t string) error
- func (s *StorePostgres) GetValue(k string) *string
- func (s *StorePostgres) GetValueAsJSON(k string, o interface{}) error
- func (s *StorePostgres) IterateAll(o interface{}, block func(k string, v string, t string, stop *bool))
- func (s *StorePostgres) IterateByKeyPrefixASCEQ(keyPrefix string, limit int, ...) error
- func (s *StorePostgres) IterateByKeyPrefixDESCEQ(keyPrefix string, limit int, ...) error
- type StoreSqlite
- func (s *StoreSqlite) AddValueAsJSON(k string, t string, o interface{}) error
- func (s *StoreSqlite) AddValueKV(k string, v string) error
- func (s *StoreSqlite) AddValueKVT(k string, v string, t string) error
- func (s *StoreSqlite) Close()
- func (s *StoreSqlite) CloseAndDelete()
- func (s *StoreSqlite) Commit()
- func (s *StoreSqlite) CountAll() (int64, string, string)
- func (s *StoreSqlite) DeleteAll() error
- func (s *StoreSqlite) DeleteAllWithTag(t string) error
- func (s *StoreSqlite) DeleteValue(k string) error
- func (s *StoreSqlite) GetValue(k string) *string
- func (s *StoreSqlite) GetValueAsJSON(k string, o interface{}) error
- func (s *StoreSqlite) IterateAll(o interface{}, block func(k string, t string, v string, stop *bool))
- func (s *StoreSqlite) IterateByKeyPrefixASC(keyPrefix string, limit int, ...) error
- func (s *StoreSqlite) IterateByKeyPrefixDESC(keyPrefix string, limit int, ...) error
- func (s *StoreSqlite) Transaction(block func()) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type StorePostgres ¶
type StorePostgres struct { Db *sql.DB Name string InsertStmt *sql.Stmt GetStmt *sql.Stmt IterateStmt *sql.Stmt IterateAllStmt *sql.Stmt IterateByPrefixASCEQ *sql.Stmt IterateByPrefixDSCEQ *sql.Stmt DeleteStmt *sql.Stmt DeleteStmtTag *sql.Stmt DeleteStmtTagLT *sql.Stmt DeleteAllStmt *sql.Stmt CountAllStmt *sql.Stmt }
StorePostgres is a 'key value' store based on Postgres DB table
func NewStorePostgres ¶
NewStorePostgres allocates a new instance and connected to the store
func NewStorePostgresWithValueType ¶
func NewStorePostgresWithValueType(name string, valueType string, connection string, db *sql.DB) (*StorePostgres, error)
NewStorePostgresWithValueType allocates a new instance and connected to the store
func (*StorePostgres) AddValueAsJSON ¶
func (s *StorePostgres) AddValueAsJSON(k string, t string, o interface{}) error
AddValueAsJSON store o under (k, t)
func (*StorePostgres) AddValueKV ¶
func (s *StorePostgres) AddValueKV(k string, v string) error
AddValueKV add a (K, V) entry to the store
func (*StorePostgres) AddValueKVT ¶
func (s *StorePostgres) AddValueKVT(k string, v string, t string) error
AddValueKVT add a (K,V,T) entry to the store
func (*StorePostgres) CountAll ¶
func (s *StorePostgres) CountAll() (int64, string, string)
CountAll will compute the count, min, max for the store
func (*StorePostgres) DeleteAll ¶
func (s *StorePostgres) DeleteAll() error
DeleteAll delete all items from the store
func (*StorePostgres) DeleteAllWithTag ¶
func (s *StorePostgres) DeleteAllWithTag(t string) error
DeleteAllWithTag delete all entries from the store with with the given tag t
func (*StorePostgres) DeleteValue ¶
func (s *StorePostgres) DeleteValue(k string) error
DeleteValue deletes the given k from the store
func (*StorePostgres) DeleteWhereTagLT ¶
func (s *StorePostgres) DeleteWhereTagLT(t string) error
DeleteWhereTagLT delete all entries with tag less than t
func (*StorePostgres) GetValue ¶
func (s *StorePostgres) GetValue(k string) *string
GetValue get the value for key k
func (*StorePostgres) GetValueAsJSON ¶
func (s *StorePostgres) GetValueAsJSON(k string, o interface{}) error
GetValueAsJSON gets the value stored for the key k
func (*StorePostgres) IterateAll ¶
func (s *StorePostgres) IterateAll( o interface{}, block func(k string, v string, t string, stop *bool))
IterateAll traverse all the stored items
func (*StorePostgres) IterateByKeyPrefixASCEQ ¶
func (s *StorePostgres) IterateByKeyPrefixASCEQ( keyPrefix string, limit int, block func(k *string, t *string, v *string, stop *bool)) error
IterateByKeyPrefixASCEQ traverse the stored items by key prefix (ascending)
func (*StorePostgres) IterateByKeyPrefixDESCEQ ¶
func (s *StorePostgres) IterateByKeyPrefixDESCEQ( keyPrefix string, limit int, block func(k *string, t *string, v *string, stop *bool)) error
IterateByKeyPrefixDESCEQ traverse the stored items by key prefix (descending)
type StoreSqlite ¶
type StoreSqlite struct { Db *sql.DB `json:"-"` InsertStmt *sql.Stmt `json:"-"` GetStmt *sql.Stmt `json:"-"` IterateStmt *sql.Stmt `json:"-"` IterateAllStmt *sql.Stmt `json:"-"` IterateByPrefixASC *sql.Stmt `json:"-"` IterateByPrefixDSC *sql.Stmt `json:"-"` DeleteStmt *sql.Stmt `json:"-"` DeleteAllStmt *sql.Stmt `json:"-"` DeleteStmtTag *sql.Stmt `json:"-"` CountAllStmt *sql.Stmt `json:"-"` Filename string `json:"filename"` // contains filtered or unexported fields }
StoreSqlite sqlite based key value store
func NewStoreSqlite ¶
func NewStoreSqlite(tableName string, folder string) (*StoreSqlite, error)
NewStoreSqlite allocate a new instance of StoreSqlite will create a sqlite file name 'tableName' in 'folder'
func (*StoreSqlite) AddValueAsJSON ¶
func (s *StoreSqlite) AddValueAsJSON(k string, t string, o interface{}) error
AddValueAsJSON add (k, t, json(o)) to the store
func (*StoreSqlite) AddValueKV ¶
func (s *StoreSqlite) AddValueKV(k string, v string) error
AddValueKV add (k,v) to the store
func (*StoreSqlite) AddValueKVT ¶
func (s *StoreSqlite) AddValueKVT(k string, v string, t string) error
AddValueKVT add (k,v,t) to the store
func (*StoreSqlite) Close ¶
func (s *StoreSqlite) Close()
Close close all the statements and the sqlite db
func (*StoreSqlite) CloseAndDelete ¶
func (s *StoreSqlite) CloseAndDelete()
CloseAndDelete deletes the sqlite DB from the file system
func (*StoreSqlite) Commit ¶
func (s *StoreSqlite) Commit()
Commit execute "COMMIT;" on the sqlite store
func (*StoreSqlite) CountAll ¶
func (s *StoreSqlite) CountAll() (int64, string, string)
CountAll count number of items in the store
func (*StoreSqlite) DeleteAll ¶
func (s *StoreSqlite) DeleteAll() error
DeleteAll delete all the data in the store
func (*StoreSqlite) DeleteAllWithTag ¶
func (s *StoreSqlite) DeleteAllWithTag(t string) error
DeleteAllWithTag delete all value with tag t from the store
func (*StoreSqlite) DeleteValue ¶
func (s *StoreSqlite) DeleteValue(k string) error
DeleteValue delete k from the store
func (*StoreSqlite) GetValue ¶
func (s *StoreSqlite) GetValue(k string) *string
GetValue get the value for the given k
func (*StoreSqlite) GetValueAsJSON ¶
func (s *StoreSqlite) GetValueAsJSON(k string, o interface{}) error
GetValueAsJSON get the value for the given k into o
func (*StoreSqlite) IterateAll ¶
func (s *StoreSqlite) IterateAll( o interface{}, block func(k string, t string, v string, stop *bool))
IterateAll traverse all the items in the store
func (*StoreSqlite) IterateByKeyPrefixASC ¶
func (s *StoreSqlite) IterateByKeyPrefixASC( keyPrefix string, limit int, block func(k *string, t *string, v *string, stop *bool)) error
IterateByKeyPrefixASC traverse all the items by keyPrefix in ASC order
func (*StoreSqlite) IterateByKeyPrefixDESC ¶
func (s *StoreSqlite) IterateByKeyPrefixDESC( keyPrefix string, limit int, block func(k *string, t *string, v *string, stop *bool)) error
IterateByKeyPrefixDESC traverse items by key prefix in DESC order
func (*StoreSqlite) Transaction ¶
func (s *StoreSqlite) Transaction(block func()) error
Transaction run the given block under a sqlite transaction