kv

package
v0.0.0-...-13f1363 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2023 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type KvItem

type KvItem struct {
	Key   string
	Value string
}

type KvStore

type KvStore struct {
	// contains filtered or unexported fields
}

func Connect

func Connect(tableName string) (KvStore, error)

Forms and checks the connection to the database and returns a kvStore object

func (*KvStore) Close

func (kv *KvStore) Close() error

Closes the connection to the underlying database

func (*KvStore) Get

func (kv *KvStore) Get(key string, value interface{}) error

Takes a key and a reference to an interface, fetches the key and unmarshal the JSON back into the interface provided.

func (*KvStore) Set

func (kv *KvStore) Set(key string, value interface{}) error

Takes an interface and stores it in a JSON format in the db.

Interfaces must have json tags for exported values or these will be lost on save.

Jump to

Keyboard shortcuts

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