Documentation ¶
Overview ¶
Package SQLtplainkv is a package implementing PlainKVer using SQlite
Index ¶
- Variables
- type SQLtPlainKV
- func (p *SQLtPlainKV) Begin() error
- func (p *SQLtPlainKV) Close() error
- func (p *SQLtPlainKV) Commit() error
- func (p *SQLtPlainKV) Del(key string) error
- func (p *SQLtPlainKV) Get(key string) ([]byte, error)
- func (p *SQLtPlainKV) GetMime(key string) (string, error)
- func (p *SQLtPlainKV) ListKeys(pattern string) ([]string, error)
- func (p *SQLtPlainKV) Open() error
- func (p *SQLtPlainKV) Rollback() error
- func (p *SQLtPlainKV) Set(key string, value []byte) error
- func (p *SQLtPlainKV) SetBucket(bucket string)
- func (p *SQLtPlainKV) SetMime(key string, mime string) error
- func (p *SQLtPlainKV) SetTableName(tableName string)
- func (p *SQLtPlainKV) Tally(key string, offset int) (int, error)
- func (p *SQLtPlainKV) TallyDecr(key string) (int, error)
- func (p *SQLtPlainKV) TallyIncr(key string) (int, error)
- func (p *SQLtPlainKV) TallyReset(key string) error
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type SQLtPlainKV ¶
type SQLtPlainKV struct { DSN string // Data Source Name // contains filtered or unexported fields }
SQLtPlainKV is a key-value database that uses SQLite database as its storage backend
func NewSQLtPlainKV ¶
func NewSQLtPlainKV(dsn string, autoClose bool) *SQLtPlainKV
NewSQLtPlainKV creates a new SQLtPlainKV object This is the recommended method
func (*SQLtPlainKV) Del ¶
func (p *SQLtPlainKV) Del(key string) error
Del deletes a record with the provided key
func (*SQLtPlainKV) Get ¶
func (p *SQLtPlainKV) Get(key string) ([]byte, error)
Get retrieves a record using a key
func (*SQLtPlainKV) GetMime ¶
func (p *SQLtPlainKV) GetMime(key string) (string, error)
Get retrieves a record using a key
func (*SQLtPlainKV) ListKeys ¶
func (p *SQLtPlainKV) ListKeys(pattern string) ([]string, error)
ListKeys lists all keys containing the current pattern
func (*SQLtPlainKV) Open ¶
func (p *SQLtPlainKV) Open() error
Open a connection to a MySQL database database
func (*SQLtPlainKV) Set ¶
func (p *SQLtPlainKV) Set(key string, value []byte) error
Set creates or updates the record by the value
func (*SQLtPlainKV) SetBucket ¶
func (p *SQLtPlainKV) SetBucket(bucket string)
SetBucket sets the current bucket. If set, all succeeding values will be retrieved and stored by the bucket name
func (*SQLtPlainKV) SetMime ¶
func (p *SQLtPlainKV) SetMime(key string, mime string) error
SetMime sets the mime of the value stored
func (*SQLtPlainKV) SetTableName ¶
func (p *SQLtPlainKV) SetTableName(tableName string)
SetTableName changes the default table name
func (*SQLtPlainKV) Tally ¶
func (p *SQLtPlainKV) Tally(key string, offset int) (int, error)
Tally gets the current tally of a key. To start with a pre-defined number, set the offset variable It automatically creates new key if it does not exist
func (*SQLtPlainKV) TallyDecr ¶
func (p *SQLtPlainKV) TallyDecr(key string) (int, error)
Decr decrements the tally
func (*SQLtPlainKV) TallyIncr ¶
func (p *SQLtPlainKV) TallyIncr(key string) (int, error)
Incr increments the tally
func (*SQLtPlainKV) TallyReset ¶
func (p *SQLtPlainKV) TallyReset(key string) error
Reset resets tally to zero