store

package
v0.0.0-...-0b87ad2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 5, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

package store is for pkid storage

package store is for pkid storage

Index

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) List

func (sqlite *SqliteStore) List() ([]string, error)

List gets all keys

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

func (*SqliteStore) Update

func (sqlite *SqliteStore) Update(key string, value string) error

Update updates a row with key and value

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL