Documentation ¶
Index ¶
- Constants
- func Delete(db *idb.Database, objectStoreName string, key js.Value) error
- func DeleteIndex(db *idb.Database, objectStoreName, indexName, pkeyName string, key js.Value) error
- func Dump(db *idb.Database, objectStoreName string) ([]string, error)
- func EncodeBytes(input []byte) js.Value
- func Get(db *idb.Database, objectStoreName string, key js.Value) (js.Value, error)
- func GetAll(db *idb.Database, objectStoreName string) ([]js.Value, error)
- func GetIndex(db *idb.Database, objectStoreName, indexName string, key js.Value) (js.Value, error)
- func NewContext() (context.Context, context.CancelFunc)
- func Put(db *idb.Database, objectStoreName string, value js.Value) (js.Value, error)
- func SendCursorRequest(cur *idb.CursorWithValueRequest, ...) error
- func SendRequest(request *idb.Request) (js.Value, error)
- type WebState
Constants ¶
const (
// ErrDoesNotExist is an error string for got undefined on Get operations.
ErrDoesNotExist = "result is undefined"
)
Variables ¶
This section is empty.
Functions ¶
func Delete ¶
Delete is a generic helper for removing values from the given idb.ObjectStore. Only usable by primary key.
func DeleteIndex ¶
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 ¶
Dump returns the given idb.ObjectStore contents to string slice for testing and debugging purposes.
func EncodeBytes ¶
EncodeBytes returns the proper IndexedDb encoding for a byte slice into js.Value.
func Get ¶
Get is a generic helper for getting values from the given idb.ObjectStore. Only usable by primary key.
func GetAll ¶
GetAll is a generic helper for getting all values from the given idb.ObjectStore.
func GetIndex ¶
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 ¶
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.
func SendCursorRequest ¶ added in v0.3.4
func SendCursorRequest(cur *idb.CursorWithValueRequest, iterFunc func(cursor *idb.CursorWithValue) error) error
SendCursorRequest is a wrapper for the cursorRequest.Await() method providing a timeout.