impl

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2023 License: BSD-2-Clause Imports: 8 Imported by: 0

Documentation

Rendered for js/wasm

Index

Constants

View Source
const (

	// ErrDoesNotExist is an error string for got undefined on Get operations.
	ErrDoesNotExist = "result is undefined"

	// ErrUniqueConstraint is an error string for failed uniqueness inserts.
	ErrUniqueConstraint = "at least one key does not satisfy the uniqueness requirements"
)

Variables

This section is empty.

Functions

func Delete

func Delete(db *idb.Database, objectStoreName string, key js.Value) error

Delete is a generic helper for removing values from the given idb.ObjectStore. Only usable by primary key.

func DeleteIndex

func DeleteIndex(db *idb.Database, objectStoreName,
	indexName, pkeyName string, key js.Value) error

DeleteIndex is a generic helper for removing values from the given idb.ObjectStore using the given idb.Index. Requires passing in the name of the primary key for the store.

func Dump

func Dump(db *idb.Database, objectStoreName string) ([]string, error)

Dump returns the given idb.ObjectStore contents to string slice for testing and debugging purposes.

func EncodeBytes

func EncodeBytes(input []byte) js.Value

EncodeBytes returns the proper IndexedDb encoding for a byte slice into js.Value.

func Get

func Get(db *idb.Database, objectStoreName string, key js.Value) (js.Value, error)

Get is a generic helper for getting values from the given idb.ObjectStore. Only usable by primary key.

func GetAll

func GetAll(db *idb.Database, objectStoreName string) ([]js.Value, error)

GetAll is a generic helper for getting all values from the given idb.ObjectStore.

func GetIndex

func GetIndex(db *idb.Database, objectStoreName,
	indexName string, key js.Value) (js.Value, error)

GetIndex is a generic helper for getting values from the given idb.ObjectStore using the given idb.Index.

func NewContext

func NewContext() (context.Context, context.CancelFunc)

NewContext builds a context for indexedDb operations.

func Put

func Put(db *idb.Database, objectStoreName string, value js.Value) (js.Value, error)

Put is a generic helper for putting values into the given idb.ObjectStore. Equivalent to insert if not exists else update. Returns the primary key of the stored object as a js.Value.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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