src/nodejs/jsindexeddb

Search:
Group by:

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