Documentation ¶
Overview ¶
package store is for pkid storage
package store is for pkid storage
Index ¶
- Variables
- type PkidStore
- type SqliteStore
- func (sqlite *SqliteStore) Delete(key string) error
- func (sqlite *SqliteStore) Get(key string) (string, error)
- func (sqlite *SqliteStore) List() ([]string, error)
- func (sqlite *SqliteStore) Migrate() error
- func (sqlite *SqliteStore) Set(key string, value string) error
- func (sqlite *SqliteStore) SetConn(filePath string) error
- func (sqlite *SqliteStore) Update(key string, value string) error
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrNotExists is an error for non existing rows in db ErrNotExists = errors.New("row not exist") // ErrSetFailed is an error when setting data fails ErrSetFailed = errors.New("set failed") // ErrDeleteFailed is an error when deleting data fails ErrDeleteFailed = errors.New("deletion failed") )
Functions ¶
This section is empty.
Types ¶
type PkidStore ¶
type PkidStore interface { SetConn(string) error Migrate() error Get(string) (string, error) Set(string, string) error Update(string, string) error Delete(string) error List() ([]string, error) }
PkidStore an interface for pkid db store
type SqliteStore ¶
type SqliteStore struct {
// contains filtered or unexported fields
}
SqliteStore is a struct for sqlite store requirements
func NewSqliteStore ¶
func NewSqliteStore() *SqliteStore
NewSqliteStore creates a new instance of sqlite database
func (*SqliteStore) Delete ¶
func (sqlite *SqliteStore) Delete(key string) error
Delete deletes the value of the given key
func (*SqliteStore) Get ¶
func (sqlite *SqliteStore) Get(key string) (string, error)
Get gets the value of the given key
func (*SqliteStore) Migrate ¶
func (sqlite *SqliteStore) Migrate() error
Migrate creates a new table includes 2 columns for key and value, key is unique
func (*SqliteStore) Set ¶
func (sqlite *SqliteStore) Set(key string, value string) error
Set adds a new row with key and value
func (*SqliteStore) SetConn ¶
func (sqlite *SqliteStore) SetConn(filePath string) error
SetConn sets the connection and filePath of the sqlite db
Click to show internal directories.
Click to hide internal directories.