src/nodejs/jsindexeddb

  • IndexedDB API for JavaScript targets.

Types

IDBDatabase {.importc.} = ref object of RootObj
  name*: cstring
  version*: cint
  objectStoreNames*: seq[cstring]
IDBObjectStore {.importc.} = ref object of RootObj
  indexNames*: seq[cstring]
  name*: cstring
  transaction*: IDBTransaction
  autoIncrement*: bool
IDBOpenDBRequest {.importc.} = ref object of RootObj
  onerror*: proc (event: Event) {.closure.}
  onsuccess*: proc (event: Event) {.closure.}
  onupgradeneeded*: proc (event: Event) {.closure.}
  result*: IDBDatabase
IDBOptions = ref object of RootObj
  autoIncrement*: bool
  keyPath*: cstring
IDBRequest {.importc.} = ref object of RootObj
  onerror*: proc (event: Event) {.closure.}
  onsuccess*: proc (event: Event) {.closure.}
  result*: JsObject
IDBTransaction {.importc.} = ref object of RootObj
  onerror*: proc (event: Event) {.closure.}
  oncomplete*: proc (event: Event) {.closure.}
IndexedDB {.importc.} = ref object of RootObj

Procs

func add(self: IDBObjectStore; value: JsObject): IDBRequest {.importcpp,
    ...raises: [], tags: [].}
func close(self: IDBDatabase) {.importcpp, ...raises: [], tags: [].}
func createObjectStore(self: IDBDatabase; name: cstring; options: IDBOptions): IDBObjectStore {.
    importcpp, ...raises: [], tags: [].}
proc delete(indexedDB: IndexedDB; storeName, id: cstring;
            options = IDBOptions(autoIncrement: true, keyPath: "id")): Future[
    bool] {....raises: [], tags: [].}
func delete(self: IDBObjectStore; key: cstring): IDBRequest {.importcpp,
    ...raises: [], tags: [].}
func deleteObjectStore(self: IDBDatabase; name: cstring) {.importcpp,
    ...raises: [], tags: [].}
func get(self: IDBObjectStore; id: cint): IDBRequest {.importcpp, ...raises: [],
    tags: [].}
proc getAll(indexedDB: IndexedDB; storeName: cstring;
            options = IDBOptions(autoIncrement: true, keyPath: "id")): Future[
    JsObject] {....raises: [], tags: [].}
func getAll(self: IDBObjectStore): IDBRequest {.importcpp, ...raises: [], tags: [].}
func newIndexedDB(): IndexedDB {.importcpp: "(window.indexedDB)", ...raises: [],
                                 tags: [].}
func objectStore(self: IDBTransaction; name: cstring): IDBObjectStore {.
    importcpp, ...raises: [], tags: [].}
func open(self: IndexedDB; dbName: cstring): IDBOpenDBRequest {.importcpp,
    ...raises: [], tags: [].}
func open(self: IndexedDB; dbName: cstring; s: cint): IDBOpenDBRequest {.
    importcpp, ...raises: [], tags: [].}
proc put(indexedDB: IndexedDB; storeName: cstring; obj: JsObject;
         options = IDBOptions(autoIncrement: true, keyPath: "id")): Future[bool] {.
    ...raises: [], tags: [].}
func put(self: IDBObjectStore; value: JsObject): IDBRequest {.importcpp,
    ...raises: [], tags: [].}
func transaction(self: IDBDatabase; names: cstring or seq[cstring]): IDBTransaction {.
    importcpp, ...raises: [], tags: [].}
func transaction(self: IDBDatabase; names: cstring or seq[cstring];
                 mode: cstring): IDBTransaction {.importcpp, ...raises: [],
    tags: [].}