1 module spasm.bindings.indexeddb; 2 3 import spasm.types; 4 import spasm.bindings.common; 5 import spasm.bindings.dom; 6 import spasm.bindings.html; 7 8 @safe: 9 nothrow: 10 11 struct IDBCursor { 12 nothrow: 13 JsHandle handle; 14 alias handle this; 15 this(Handle h) { 16 this.handle = JsHandle(h); 17 } 18 auto source()() { 19 return IDBCursor_source_Get(this.handle); 20 } 21 auto direction()() { 22 return IDBCursor_direction_Get(this.handle); 23 } 24 auto key()() { 25 return Any(IDBCursor_key_Get(this.handle)); 26 } 27 auto primaryKey()() { 28 return Any(IDBCursor_primaryKey_Get(this.handle)); 29 } 30 void advance()(uint count) { 31 IDBCursor_advance(this.handle, count); 32 } 33 void continue_(T0)(scope auto ref T0 key) { 34 Handle _handle_key = getOrCreateHandle(key); 35 IDBCursor_continue(this.handle, _handle_key); 36 dropHandle!(T0)(_handle_key); 37 } 38 void continue_()() { 39 IDBCursor_continue_0(this.handle); 40 } 41 void continuePrimaryKey(T0, T1)(scope auto ref T0 key, scope auto ref T1 primaryKey) { 42 Handle _handle_key = getOrCreateHandle(key); 43 Handle _handle_primaryKey = getOrCreateHandle(primaryKey); 44 IDBCursor_continuePrimaryKey(this.handle, _handle_key, _handle_primaryKey); 45 dropHandle!(T0)(_handle_key); 46 dropHandle!(T1)(_handle_primaryKey); 47 } 48 auto update(T0)(scope auto ref T0 value) { 49 Handle _handle_value = getOrCreateHandle(value); 50 auto result = IDBRequest(IDBCursor_update(this.handle, _handle_value)); 51 dropHandle!(T0)(_handle_value); 52 return result; 53 } 54 auto delete_()() { 55 return IDBRequest(IDBCursor_delete(this.handle)); 56 } 57 } 58 enum IDBCursorDirection { 59 next, 60 nextunique, 61 prev, 62 prevunique 63 } 64 struct IDBCursorWithValue { 65 nothrow: 66 spasm.bindings.indexeddb.IDBCursor _parent; 67 alias _parent this; 68 this(Handle h) { 69 _parent = .IDBCursor(h); 70 } 71 auto value()() { 72 return Any(IDBCursorWithValue_value_Get(this._parent)); 73 } 74 } 75 struct IDBDatabase { 76 nothrow: 77 spasm.bindings.dom.EventTarget _parent; 78 alias _parent this; 79 this(Handle h) { 80 _parent = .EventTarget(h); 81 } 82 auto name()() { 83 return IDBDatabase_name_Get(this._parent); 84 } 85 auto version_()() { 86 return IDBDatabase_version_Get(this._parent); 87 } 88 auto objectStoreNames()() { 89 return DOMStringList(IDBDatabase_objectStoreNames_Get(this._parent)); 90 } 91 auto transaction()(scope ref SumType!(string, Sequence!(string)) storeNames, IDBTransactionMode mode /* = "readonly" */) { 92 return IDBTransaction(IDBDatabase_transaction(this._parent, storeNames, mode)); 93 } 94 auto transaction()(scope ref SumType!(string, Sequence!(string)) storeNames) { 95 return IDBTransaction(IDBDatabase_transaction_0(this._parent, storeNames)); 96 } 97 void close()() { 98 IDBDatabase_close(this._parent); 99 } 100 auto createObjectStore()(string name, scope ref IDBObjectStoreParameters options) { 101 return IDBObjectStore(IDBDatabase_createObjectStore(this._parent, name, options.handle)); 102 } 103 auto createObjectStore()(string name) { 104 return IDBObjectStore(IDBDatabase_createObjectStore_0(this._parent, name)); 105 } 106 void deleteObjectStore()(string name) { 107 IDBDatabase_deleteObjectStore(this._parent, name); 108 } 109 void onabort()(EventHandler onabort) { 110 IDBDatabase_onabort_Set(this._parent, onabort); 111 } 112 auto onabort()() { 113 return IDBDatabase_onabort_Get(this._parent); 114 } 115 void onclose()(EventHandler onclose) { 116 IDBDatabase_onclose_Set(this._parent, onclose); 117 } 118 auto onclose()() { 119 return IDBDatabase_onclose_Get(this._parent); 120 } 121 void onerror()(EventHandler onerror) { 122 IDBDatabase_onerror_Set(this._parent, onerror); 123 } 124 auto onerror()() { 125 return IDBDatabase_onerror_Get(this._parent); 126 } 127 void onversionchange()(EventHandler onversionchange) { 128 IDBDatabase_onversionchange_Set(this._parent, onversionchange); 129 } 130 auto onversionchange()() { 131 return IDBDatabase_onversionchange_Get(this._parent); 132 } 133 } 134 struct IDBDatabaseInfo { 135 nothrow: 136 JsHandle handle; 137 alias handle this; 138 this(Handle h) { 139 this.handle = JsHandle(h); 140 } 141 static auto create() { 142 return IDBDatabaseInfo(spasm_add__object()); 143 } 144 void name()(string name) { 145 IDBDatabaseInfo_name_Set(this.handle, name); 146 } 147 auto name()() { 148 return IDBDatabaseInfo_name_Get(this.handle); 149 } 150 void version_()(uint version_) { 151 IDBDatabaseInfo_version_Set(this.handle, version_); 152 } 153 auto version_()() { 154 return IDBDatabaseInfo_version_Get(this.handle); 155 } 156 } 157 struct IDBFactory { 158 nothrow: 159 JsHandle handle; 160 alias handle this; 161 this(Handle h) { 162 this.handle = JsHandle(h); 163 } 164 auto open()(string name, uint version_) { 165 return IDBOpenDBRequest(IDBFactory_open(this.handle, name, version_)); 166 } 167 auto open()(string name) { 168 return IDBOpenDBRequest(IDBFactory_open_0(this.handle, name)); 169 } 170 auto deleteDatabase()(string name) { 171 return IDBOpenDBRequest(IDBFactory_deleteDatabase(this.handle, name)); 172 } 173 auto databases()() { 174 return Promise!(Sequence!(IDBDatabaseInfo))(IDBFactory_databases(this.handle)); 175 } 176 auto cmp(T0, T1)(scope auto ref T0 first, scope auto ref T1 second) { 177 Handle _handle_first = getOrCreateHandle(first); 178 Handle _handle_second = getOrCreateHandle(second); 179 auto result = IDBFactory_cmp(this.handle, _handle_first, _handle_second); 180 dropHandle!(T0)(_handle_first); 181 dropHandle!(T1)(_handle_second); 182 return result; 183 } 184 } 185 struct IDBIndex { 186 nothrow: 187 JsHandle handle; 188 alias handle this; 189 this(Handle h) { 190 this.handle = JsHandle(h); 191 } 192 void name()(string name) { 193 IDBIndex_name_Set(this.handle, name); 194 } 195 auto name()() { 196 return IDBIndex_name_Get(this.handle); 197 } 198 auto objectStore()() { 199 return IDBObjectStore(IDBIndex_objectStore_Get(this.handle)); 200 } 201 auto keyPath()() { 202 return Any(IDBIndex_keyPath_Get(this.handle)); 203 } 204 auto multiEntry()() { 205 return IDBIndex_multiEntry_Get(this.handle); 206 } 207 auto unique()() { 208 return IDBIndex_unique_Get(this.handle); 209 } 210 auto get(T0)(scope auto ref T0 query) { 211 Handle _handle_query = getOrCreateHandle(query); 212 auto result = IDBRequest(IDBIndex_get(this.handle, _handle_query)); 213 dropHandle!(T0)(_handle_query); 214 return result; 215 } 216 auto getKey(T0)(scope auto ref T0 query) { 217 Handle _handle_query = getOrCreateHandle(query); 218 auto result = IDBRequest(IDBIndex_getKey(this.handle, _handle_query)); 219 dropHandle!(T0)(_handle_query); 220 return result; 221 } 222 auto getAll(T0)(scope auto ref T0 query, uint count) { 223 Handle _handle_query = getOrCreateHandle(query); 224 auto result = IDBRequest(IDBIndex_getAll(this.handle, _handle_query, count)); 225 dropHandle!(T0)(_handle_query); 226 return result; 227 } 228 auto getAll(T0)(scope auto ref T0 query) { 229 Handle _handle_query = getOrCreateHandle(query); 230 auto result = IDBRequest(IDBIndex_getAll_0(this.handle, _handle_query)); 231 dropHandle!(T0)(_handle_query); 232 return result; 233 } 234 auto getAll()() { 235 return IDBRequest(IDBIndex_getAll_1(this.handle)); 236 } 237 auto getAllKeys(T0)(scope auto ref T0 query, uint count) { 238 Handle _handle_query = getOrCreateHandle(query); 239 auto result = IDBRequest(IDBIndex_getAllKeys(this.handle, _handle_query, count)); 240 dropHandle!(T0)(_handle_query); 241 return result; 242 } 243 auto getAllKeys(T0)(scope auto ref T0 query) { 244 Handle _handle_query = getOrCreateHandle(query); 245 auto result = IDBRequest(IDBIndex_getAllKeys_0(this.handle, _handle_query)); 246 dropHandle!(T0)(_handle_query); 247 return result; 248 } 249 auto getAllKeys()() { 250 return IDBRequest(IDBIndex_getAllKeys_1(this.handle)); 251 } 252 auto count(T0)(scope auto ref T0 query) { 253 Handle _handle_query = getOrCreateHandle(query); 254 auto result = IDBRequest(IDBIndex_count(this.handle, _handle_query)); 255 dropHandle!(T0)(_handle_query); 256 return result; 257 } 258 auto count()() { 259 return IDBRequest(IDBIndex_count_0(this.handle)); 260 } 261 auto openCursor(T0)(scope auto ref T0 query, IDBCursorDirection direction /* = "next" */) { 262 Handle _handle_query = getOrCreateHandle(query); 263 auto result = IDBRequest(IDBIndex_openCursor(this.handle, _handle_query, direction)); 264 dropHandle!(T0)(_handle_query); 265 return result; 266 } 267 auto openCursor(T0)(scope auto ref T0 query) { 268 Handle _handle_query = getOrCreateHandle(query); 269 auto result = IDBRequest(IDBIndex_openCursor_0(this.handle, _handle_query)); 270 dropHandle!(T0)(_handle_query); 271 return result; 272 } 273 auto openCursor()() { 274 return IDBRequest(IDBIndex_openCursor_1(this.handle)); 275 } 276 auto openKeyCursor(T0)(scope auto ref T0 query, IDBCursorDirection direction /* = "next" */) { 277 Handle _handle_query = getOrCreateHandle(query); 278 auto result = IDBRequest(IDBIndex_openKeyCursor(this.handle, _handle_query, direction)); 279 dropHandle!(T0)(_handle_query); 280 return result; 281 } 282 auto openKeyCursor(T0)(scope auto ref T0 query) { 283 Handle _handle_query = getOrCreateHandle(query); 284 auto result = IDBRequest(IDBIndex_openKeyCursor_0(this.handle, _handle_query)); 285 dropHandle!(T0)(_handle_query); 286 return result; 287 } 288 auto openKeyCursor()() { 289 return IDBRequest(IDBIndex_openKeyCursor_1(this.handle)); 290 } 291 } 292 struct IDBIndexParameters { 293 nothrow: 294 JsHandle handle; 295 alias handle this; 296 this(Handle h) { 297 this.handle = JsHandle(h); 298 } 299 static auto create() { 300 return IDBIndexParameters(spasm_add__object()); 301 } 302 void unique()(bool unique) { 303 IDBIndexParameters_unique_Set(this.handle, unique); 304 } 305 auto unique()() { 306 return IDBIndexParameters_unique_Get(this.handle); 307 } 308 void multiEntry()(bool multiEntry) { 309 IDBIndexParameters_multiEntry_Set(this.handle, multiEntry); 310 } 311 auto multiEntry()() { 312 return IDBIndexParameters_multiEntry_Get(this.handle); 313 } 314 } 315 struct IDBKeyRange { 316 nothrow: 317 JsHandle handle; 318 alias handle this; 319 this(Handle h) { 320 this.handle = JsHandle(h); 321 } 322 auto lower()() { 323 return Any(IDBKeyRange_lower_Get(this.handle)); 324 } 325 auto upper()() { 326 return Any(IDBKeyRange_upper_Get(this.handle)); 327 } 328 auto lowerOpen()() { 329 return IDBKeyRange_lowerOpen_Get(this.handle); 330 } 331 auto upperOpen()() { 332 return IDBKeyRange_upperOpen_Get(this.handle); 333 } 334 auto only(T0)(scope auto ref T0 value) { 335 Handle _handle_value = getOrCreateHandle(value); 336 auto result = IDBKeyRange(IDBKeyRange_only(this.handle, _handle_value)); 337 dropHandle!(T0)(_handle_value); 338 return result; 339 } 340 auto lowerBound(T0)(scope auto ref T0 lower, bool open /* = false */) { 341 Handle _handle_lower = getOrCreateHandle(lower); 342 auto result = IDBKeyRange(IDBKeyRange_lowerBound(this.handle, _handle_lower, open)); 343 dropHandle!(T0)(_handle_lower); 344 return result; 345 } 346 auto lowerBound(T0)(scope auto ref T0 lower) { 347 Handle _handle_lower = getOrCreateHandle(lower); 348 auto result = IDBKeyRange(IDBKeyRange_lowerBound_0(this.handle, _handle_lower)); 349 dropHandle!(T0)(_handle_lower); 350 return result; 351 } 352 auto upperBound(T0)(scope auto ref T0 upper, bool open /* = false */) { 353 Handle _handle_upper = getOrCreateHandle(upper); 354 auto result = IDBKeyRange(IDBKeyRange_upperBound(this.handle, _handle_upper, open)); 355 dropHandle!(T0)(_handle_upper); 356 return result; 357 } 358 auto upperBound(T0)(scope auto ref T0 upper) { 359 Handle _handle_upper = getOrCreateHandle(upper); 360 auto result = IDBKeyRange(IDBKeyRange_upperBound_0(this.handle, _handle_upper)); 361 dropHandle!(T0)(_handle_upper); 362 return result; 363 } 364 auto bound(T0, T1)(scope auto ref T0 lower, scope auto ref T1 upper, bool lowerOpen /* = false */, bool upperOpen /* = false */) { 365 Handle _handle_lower = getOrCreateHandle(lower); 366 Handle _handle_upper = getOrCreateHandle(upper); 367 auto result = IDBKeyRange(IDBKeyRange_bound(this.handle, _handle_lower, _handle_upper, lowerOpen, upperOpen)); 368 dropHandle!(T0)(_handle_lower); 369 dropHandle!(T1)(_handle_upper); 370 return result; 371 } 372 auto bound(T0, T1)(scope auto ref T0 lower, scope auto ref T1 upper, bool lowerOpen /* = false */) { 373 Handle _handle_lower = getOrCreateHandle(lower); 374 Handle _handle_upper = getOrCreateHandle(upper); 375 auto result = IDBKeyRange(IDBKeyRange_bound_0(this.handle, _handle_lower, _handle_upper, lowerOpen)); 376 dropHandle!(T0)(_handle_lower); 377 dropHandle!(T1)(_handle_upper); 378 return result; 379 } 380 auto bound(T0, T1)(scope auto ref T0 lower, scope auto ref T1 upper) { 381 Handle _handle_lower = getOrCreateHandle(lower); 382 Handle _handle_upper = getOrCreateHandle(upper); 383 auto result = IDBKeyRange(IDBKeyRange_bound_1(this.handle, _handle_lower, _handle_upper)); 384 dropHandle!(T0)(_handle_lower); 385 dropHandle!(T1)(_handle_upper); 386 return result; 387 } 388 auto _includes(T0)(scope auto ref T0 key) { 389 Handle _handle_key = getOrCreateHandle(key); 390 auto result = IDBKeyRange__includes(this.handle, _handle_key); 391 dropHandle!(T0)(_handle_key); 392 return result; 393 } 394 } 395 struct IDBObjectStore { 396 nothrow: 397 JsHandle handle; 398 alias handle this; 399 this(Handle h) { 400 this.handle = JsHandle(h); 401 } 402 void name()(string name) { 403 IDBObjectStore_name_Set(this.handle, name); 404 } 405 auto name()() { 406 return IDBObjectStore_name_Get(this.handle); 407 } 408 auto keyPath()() { 409 return Any(IDBObjectStore_keyPath_Get(this.handle)); 410 } 411 auto indexNames()() { 412 return DOMStringList(IDBObjectStore_indexNames_Get(this.handle)); 413 } 414 auto transaction()() { 415 return IDBTransaction(IDBObjectStore_transaction_Get(this.handle)); 416 } 417 auto autoIncrement()() { 418 return IDBObjectStore_autoIncrement_Get(this.handle); 419 } 420 auto put(T0, T1)(scope auto ref T0 value, scope auto ref T1 key) { 421 Handle _handle_value = getOrCreateHandle(value); 422 Handle _handle_key = getOrCreateHandle(key); 423 auto result = IDBRequest(IDBObjectStore_put(this.handle, _handle_value, _handle_key)); 424 dropHandle!(T0)(_handle_value); 425 dropHandle!(T1)(_handle_key); 426 return result; 427 } 428 auto put(T0)(scope auto ref T0 value) { 429 Handle _handle_value = getOrCreateHandle(value); 430 auto result = IDBRequest(IDBObjectStore_put_0(this.handle, _handle_value)); 431 dropHandle!(T0)(_handle_value); 432 return result; 433 } 434 auto add(T0, T1)(scope auto ref T0 value, scope auto ref T1 key) { 435 Handle _handle_value = getOrCreateHandle(value); 436 Handle _handle_key = getOrCreateHandle(key); 437 auto result = IDBRequest(IDBObjectStore_add(this.handle, _handle_value, _handle_key)); 438 dropHandle!(T0)(_handle_value); 439 dropHandle!(T1)(_handle_key); 440 return result; 441 } 442 auto add(T0)(scope auto ref T0 value) { 443 Handle _handle_value = getOrCreateHandle(value); 444 auto result = IDBRequest(IDBObjectStore_add_0(this.handle, _handle_value)); 445 dropHandle!(T0)(_handle_value); 446 return result; 447 } 448 auto delete_(T0)(scope auto ref T0 query) { 449 Handle _handle_query = getOrCreateHandle(query); 450 auto result = IDBRequest(IDBObjectStore_delete(this.handle, _handle_query)); 451 dropHandle!(T0)(_handle_query); 452 return result; 453 } 454 auto clear()() { 455 return IDBRequest(IDBObjectStore_clear(this.handle)); 456 } 457 auto get(T0)(scope auto ref T0 query) { 458 Handle _handle_query = getOrCreateHandle(query); 459 auto result = IDBRequest(IDBObjectStore_get(this.handle, _handle_query)); 460 dropHandle!(T0)(_handle_query); 461 return result; 462 } 463 auto getKey(T0)(scope auto ref T0 query) { 464 Handle _handle_query = getOrCreateHandle(query); 465 auto result = IDBRequest(IDBObjectStore_getKey(this.handle, _handle_query)); 466 dropHandle!(T0)(_handle_query); 467 return result; 468 } 469 auto getAll(T0)(scope auto ref T0 query, uint count) { 470 Handle _handle_query = getOrCreateHandle(query); 471 auto result = IDBRequest(IDBObjectStore_getAll(this.handle, _handle_query, count)); 472 dropHandle!(T0)(_handle_query); 473 return result; 474 } 475 auto getAll(T0)(scope auto ref T0 query) { 476 Handle _handle_query = getOrCreateHandle(query); 477 auto result = IDBRequest(IDBObjectStore_getAll_0(this.handle, _handle_query)); 478 dropHandle!(T0)(_handle_query); 479 return result; 480 } 481 auto getAll()() { 482 return IDBRequest(IDBObjectStore_getAll_1(this.handle)); 483 } 484 auto getAllKeys(T0)(scope auto ref T0 query, uint count) { 485 Handle _handle_query = getOrCreateHandle(query); 486 auto result = IDBRequest(IDBObjectStore_getAllKeys(this.handle, _handle_query, count)); 487 dropHandle!(T0)(_handle_query); 488 return result; 489 } 490 auto getAllKeys(T0)(scope auto ref T0 query) { 491 Handle _handle_query = getOrCreateHandle(query); 492 auto result = IDBRequest(IDBObjectStore_getAllKeys_0(this.handle, _handle_query)); 493 dropHandle!(T0)(_handle_query); 494 return result; 495 } 496 auto getAllKeys()() { 497 return IDBRequest(IDBObjectStore_getAllKeys_1(this.handle)); 498 } 499 auto count(T0)(scope auto ref T0 query) { 500 Handle _handle_query = getOrCreateHandle(query); 501 auto result = IDBRequest(IDBObjectStore_count(this.handle, _handle_query)); 502 dropHandle!(T0)(_handle_query); 503 return result; 504 } 505 auto count()() { 506 return IDBRequest(IDBObjectStore_count_0(this.handle)); 507 } 508 auto openCursor(T0)(scope auto ref T0 query, IDBCursorDirection direction /* = "next" */) { 509 Handle _handle_query = getOrCreateHandle(query); 510 auto result = IDBRequest(IDBObjectStore_openCursor(this.handle, _handle_query, direction)); 511 dropHandle!(T0)(_handle_query); 512 return result; 513 } 514 auto openCursor(T0)(scope auto ref T0 query) { 515 Handle _handle_query = getOrCreateHandle(query); 516 auto result = IDBRequest(IDBObjectStore_openCursor_0(this.handle, _handle_query)); 517 dropHandle!(T0)(_handle_query); 518 return result; 519 } 520 auto openCursor()() { 521 return IDBRequest(IDBObjectStore_openCursor_1(this.handle)); 522 } 523 auto openKeyCursor(T0)(scope auto ref T0 query, IDBCursorDirection direction /* = "next" */) { 524 Handle _handle_query = getOrCreateHandle(query); 525 auto result = IDBRequest(IDBObjectStore_openKeyCursor(this.handle, _handle_query, direction)); 526 dropHandle!(T0)(_handle_query); 527 return result; 528 } 529 auto openKeyCursor(T0)(scope auto ref T0 query) { 530 Handle _handle_query = getOrCreateHandle(query); 531 auto result = IDBRequest(IDBObjectStore_openKeyCursor_0(this.handle, _handle_query)); 532 dropHandle!(T0)(_handle_query); 533 return result; 534 } 535 auto openKeyCursor()() { 536 return IDBRequest(IDBObjectStore_openKeyCursor_1(this.handle)); 537 } 538 auto index()(string name) { 539 return IDBIndex(IDBObjectStore_index(this.handle, name)); 540 } 541 auto createIndex()(string name, scope ref SumType!(string, Sequence!(string)) keyPath, scope ref IDBIndexParameters options) { 542 return IDBIndex(IDBObjectStore_createIndex(this.handle, name, keyPath, options.handle)); 543 } 544 auto createIndex()(string name, scope ref SumType!(string, Sequence!(string)) keyPath) { 545 return IDBIndex(IDBObjectStore_createIndex_0(this.handle, name, keyPath)); 546 } 547 void deleteIndex()(string name) { 548 IDBObjectStore_deleteIndex(this.handle, name); 549 } 550 } 551 struct IDBObjectStoreParameters { 552 nothrow: 553 JsHandle handle; 554 alias handle this; 555 this(Handle h) { 556 this.handle = JsHandle(h); 557 } 558 static auto create() { 559 return IDBObjectStoreParameters(spasm_add__object()); 560 } 561 void keyPath(T0)(scope auto ref Optional!(T0) keyPath) if (isTOrPointer!(T0, SumType!(string, Sequence!(string)))) { 562 IDBObjectStoreParameters_keyPath_Set(this.handle, !keyPath.empty, *keyPath.frontRef); 563 } 564 auto keyPath()() { 565 return IDBObjectStoreParameters_keyPath_Get(this.handle); 566 } 567 void autoIncrement()(bool autoIncrement) { 568 IDBObjectStoreParameters_autoIncrement_Set(this.handle, autoIncrement); 569 } 570 auto autoIncrement()() { 571 return IDBObjectStoreParameters_autoIncrement_Get(this.handle); 572 } 573 } 574 struct IDBOpenDBRequest { 575 nothrow: 576 spasm.bindings.indexeddb.IDBRequest _parent; 577 alias _parent this; 578 this(Handle h) { 579 _parent = .IDBRequest(h); 580 } 581 void onblocked()(EventHandler onblocked) { 582 IDBOpenDBRequest_onblocked_Set(this._parent, onblocked); 583 } 584 auto onblocked()() { 585 return IDBOpenDBRequest_onblocked_Get(this._parent); 586 } 587 void onupgradeneeded()(EventHandler onupgradeneeded) { 588 IDBOpenDBRequest_onupgradeneeded_Set(this._parent, onupgradeneeded); 589 } 590 auto onupgradeneeded()() { 591 return IDBOpenDBRequest_onupgradeneeded_Get(this._parent); 592 } 593 } 594 struct IDBRequest { 595 nothrow: 596 spasm.bindings.dom.EventTarget _parent; 597 alias _parent this; 598 this(Handle h) { 599 _parent = .EventTarget(h); 600 } 601 auto result()() { 602 return Any(IDBRequest_result_Get(this._parent)); 603 } 604 auto error()() { 605 return IDBRequest_error_Get(this._parent); 606 } 607 auto source()() { 608 return IDBRequest_source_Get(this._parent); 609 } 610 auto transaction()() { 611 return IDBRequest_transaction_Get(this._parent); 612 } 613 auto readyState()() { 614 return IDBRequest_readyState_Get(this._parent); 615 } 616 void onsuccess()(EventHandler onsuccess) { 617 IDBRequest_onsuccess_Set(this._parent, onsuccess); 618 } 619 auto onsuccess()() { 620 return IDBRequest_onsuccess_Get(this._parent); 621 } 622 void onerror()(EventHandler onerror) { 623 IDBRequest_onerror_Set(this._parent, onerror); 624 } 625 auto onerror()() { 626 return IDBRequest_onerror_Get(this._parent); 627 } 628 } 629 enum IDBRequestReadyState { 630 pending, 631 done 632 } 633 struct IDBTransaction { 634 nothrow: 635 spasm.bindings.dom.EventTarget _parent; 636 alias _parent this; 637 this(Handle h) { 638 _parent = .EventTarget(h); 639 } 640 auto objectStoreNames()() { 641 return DOMStringList(IDBTransaction_objectStoreNames_Get(this._parent)); 642 } 643 auto mode()() { 644 return IDBTransaction_mode_Get(this._parent); 645 } 646 auto db()() { 647 return IDBDatabase(IDBTransaction_db_Get(this._parent)); 648 } 649 auto error()() { 650 return DOMException(IDBTransaction_error_Get(this._parent)); 651 } 652 auto objectStore()(string name) { 653 return IDBObjectStore(IDBTransaction_objectStore(this._parent, name)); 654 } 655 void abort()() { 656 IDBTransaction_abort(this._parent); 657 } 658 void onabort()(EventHandler onabort) { 659 IDBTransaction_onabort_Set(this._parent, onabort); 660 } 661 auto onabort()() { 662 return IDBTransaction_onabort_Get(this._parent); 663 } 664 void oncomplete()(EventHandler oncomplete) { 665 IDBTransaction_oncomplete_Set(this._parent, oncomplete); 666 } 667 auto oncomplete()() { 668 return IDBTransaction_oncomplete_Get(this._parent); 669 } 670 void onerror()(EventHandler onerror) { 671 IDBTransaction_onerror_Set(this._parent, onerror); 672 } 673 auto onerror()() { 674 return IDBTransaction_onerror_Get(this._parent); 675 } 676 } 677 enum IDBTransactionMode { 678 readonly, 679 readwrite, 680 versionchange 681 } 682 struct IDBVersionChangeEvent { 683 nothrow: 684 spasm.bindings.dom.Event _parent; 685 alias _parent this; 686 this(Handle h) { 687 _parent = .Event(h); 688 } 689 auto oldVersion()() { 690 return IDBVersionChangeEvent_oldVersion_Get(this._parent); 691 } 692 auto newVersion()() { 693 return IDBVersionChangeEvent_newVersion_Get(this._parent); 694 } 695 } 696 struct IDBVersionChangeEventInit { 697 nothrow: 698 spasm.bindings.dom.EventInit _parent; 699 alias _parent this; 700 this(Handle h) { 701 _parent = .EventInit(h); 702 } 703 static auto create() { 704 return IDBVersionChangeEventInit(spasm_add__object()); 705 } 706 void oldVersion()(uint oldVersion) { 707 IDBVersionChangeEventInit_oldVersion_Set(this._parent, oldVersion); 708 } 709 auto oldVersion()() { 710 return IDBVersionChangeEventInit_oldVersion_Get(this._parent); 711 } 712 void newVersion(T0)(scope auto ref Optional!(T0) newVersion) if (isTOrPointer!(T0, uint)) { 713 IDBVersionChangeEventInit_newVersion_Set(this._parent, !newVersion.empty, newVersion.front); 714 } 715 auto newVersion()() { 716 return IDBVersionChangeEventInit_newVersion_Get(this._parent); 717 } 718 } 719 720 721 extern (C) SumType!(IDBObjectStore, IDBIndex) IDBCursor_source_Get(Handle); 722 extern (C) IDBCursorDirection IDBCursor_direction_Get(Handle); 723 extern (C) Handle IDBCursor_key_Get(Handle); 724 extern (C) Handle IDBCursor_primaryKey_Get(Handle); 725 extern (C) void IDBCursor_advance(Handle, uint); 726 extern (C) void IDBCursor_continue(Handle, Handle); 727 extern (C) void IDBCursor_continue_0(Handle); 728 extern (C) void IDBCursor_continuePrimaryKey(Handle, Handle, Handle); 729 extern (C) Handle IDBCursor_update(Handle, Handle); 730 extern (C) Handle IDBCursor_delete(Handle); 731 extern (C) Handle IDBCursorWithValue_value_Get(Handle); 732 extern (C) string IDBDatabase_name_Get(Handle); 733 extern (C) uint IDBDatabase_version_Get(Handle); 734 extern (C) Handle IDBDatabase_objectStoreNames_Get(Handle); 735 extern (C) Handle IDBDatabase_transaction(Handle, scope ref SumType!(string, Sequence!(string)), IDBTransactionMode); 736 extern (C) Handle IDBDatabase_transaction_0(Handle, scope ref SumType!(string, Sequence!(string))); 737 extern (C) void IDBDatabase_close(Handle); 738 extern (C) Handle IDBDatabase_createObjectStore(Handle, string, Handle); 739 extern (C) Handle IDBDatabase_createObjectStore_0(Handle, string); 740 extern (C) void IDBDatabase_deleteObjectStore(Handle, string); 741 extern (C) void IDBDatabase_onabort_Set(Handle, EventHandler); 742 extern (C) EventHandler IDBDatabase_onabort_Get(Handle); 743 extern (C) void IDBDatabase_onclose_Set(Handle, EventHandler); 744 extern (C) EventHandler IDBDatabase_onclose_Get(Handle); 745 extern (C) void IDBDatabase_onerror_Set(Handle, EventHandler); 746 extern (C) EventHandler IDBDatabase_onerror_Get(Handle); 747 extern (C) void IDBDatabase_onversionchange_Set(Handle, EventHandler); 748 extern (C) EventHandler IDBDatabase_onversionchange_Get(Handle); 749 extern (C) void IDBDatabaseInfo_name_Set(Handle, string); 750 extern (C) string IDBDatabaseInfo_name_Get(Handle); 751 extern (C) void IDBDatabaseInfo_version_Set(Handle, uint); 752 extern (C) uint IDBDatabaseInfo_version_Get(Handle); 753 extern (C) Handle IDBFactory_open(Handle, string, uint); 754 extern (C) Handle IDBFactory_open_0(Handle, string); 755 extern (C) Handle IDBFactory_deleteDatabase(Handle, string); 756 extern (C) Handle IDBFactory_databases(Handle); 757 extern (C) short IDBFactory_cmp(Handle, Handle, Handle); 758 extern (C) void IDBIndex_name_Set(Handle, string); 759 extern (C) string IDBIndex_name_Get(Handle); 760 extern (C) Handle IDBIndex_objectStore_Get(Handle); 761 extern (C) Handle IDBIndex_keyPath_Get(Handle); 762 extern (C) bool IDBIndex_multiEntry_Get(Handle); 763 extern (C) bool IDBIndex_unique_Get(Handle); 764 extern (C) Handle IDBIndex_get(Handle, Handle); 765 extern (C) Handle IDBIndex_getKey(Handle, Handle); 766 extern (C) Handle IDBIndex_getAll(Handle, Handle, uint); 767 extern (C) Handle IDBIndex_getAll_0(Handle, Handle); 768 extern (C) Handle IDBIndex_getAll_1(Handle); 769 extern (C) Handle IDBIndex_getAllKeys(Handle, Handle, uint); 770 extern (C) Handle IDBIndex_getAllKeys_0(Handle, Handle); 771 extern (C) Handle IDBIndex_getAllKeys_1(Handle); 772 extern (C) Handle IDBIndex_count(Handle, Handle); 773 extern (C) Handle IDBIndex_count_0(Handle); 774 extern (C) Handle IDBIndex_openCursor(Handle, Handle, IDBCursorDirection); 775 extern (C) Handle IDBIndex_openCursor_0(Handle, Handle); 776 extern (C) Handle IDBIndex_openCursor_1(Handle); 777 extern (C) Handle IDBIndex_openKeyCursor(Handle, Handle, IDBCursorDirection); 778 extern (C) Handle IDBIndex_openKeyCursor_0(Handle, Handle); 779 extern (C) Handle IDBIndex_openKeyCursor_1(Handle); 780 extern (C) void IDBIndexParameters_unique_Set(Handle, bool); 781 extern (C) bool IDBIndexParameters_unique_Get(Handle); 782 extern (C) void IDBIndexParameters_multiEntry_Set(Handle, bool); 783 extern (C) bool IDBIndexParameters_multiEntry_Get(Handle); 784 extern (C) Handle IDBKeyRange_lower_Get(Handle); 785 extern (C) Handle IDBKeyRange_upper_Get(Handle); 786 extern (C) bool IDBKeyRange_lowerOpen_Get(Handle); 787 extern (C) bool IDBKeyRange_upperOpen_Get(Handle); 788 extern (C) Handle IDBKeyRange_only(Handle, Handle); 789 extern (C) Handle IDBKeyRange_lowerBound(Handle, Handle, bool); 790 extern (C) Handle IDBKeyRange_lowerBound_0(Handle, Handle); 791 extern (C) Handle IDBKeyRange_upperBound(Handle, Handle, bool); 792 extern (C) Handle IDBKeyRange_upperBound_0(Handle, Handle); 793 extern (C) Handle IDBKeyRange_bound(Handle, Handle, Handle, bool, bool); 794 extern (C) Handle IDBKeyRange_bound_0(Handle, Handle, Handle, bool); 795 extern (C) Handle IDBKeyRange_bound_1(Handle, Handle, Handle); 796 extern (C) bool IDBKeyRange__includes(Handle, Handle); 797 extern (C) void IDBObjectStore_name_Set(Handle, string); 798 extern (C) string IDBObjectStore_name_Get(Handle); 799 extern (C) Handle IDBObjectStore_keyPath_Get(Handle); 800 extern (C) Handle IDBObjectStore_indexNames_Get(Handle); 801 extern (C) Handle IDBObjectStore_transaction_Get(Handle); 802 extern (C) bool IDBObjectStore_autoIncrement_Get(Handle); 803 extern (C) Handle IDBObjectStore_put(Handle, Handle, Handle); 804 extern (C) Handle IDBObjectStore_put_0(Handle, Handle); 805 extern (C) Handle IDBObjectStore_add(Handle, Handle, Handle); 806 extern (C) Handle IDBObjectStore_add_0(Handle, Handle); 807 extern (C) Handle IDBObjectStore_delete(Handle, Handle); 808 extern (C) Handle IDBObjectStore_clear(Handle); 809 extern (C) Handle IDBObjectStore_get(Handle, Handle); 810 extern (C) Handle IDBObjectStore_getKey(Handle, Handle); 811 extern (C) Handle IDBObjectStore_getAll(Handle, Handle, uint); 812 extern (C) Handle IDBObjectStore_getAll_0(Handle, Handle); 813 extern (C) Handle IDBObjectStore_getAll_1(Handle); 814 extern (C) Handle IDBObjectStore_getAllKeys(Handle, Handle, uint); 815 extern (C) Handle IDBObjectStore_getAllKeys_0(Handle, Handle); 816 extern (C) Handle IDBObjectStore_getAllKeys_1(Handle); 817 extern (C) Handle IDBObjectStore_count(Handle, Handle); 818 extern (C) Handle IDBObjectStore_count_0(Handle); 819 extern (C) Handle IDBObjectStore_openCursor(Handle, Handle, IDBCursorDirection); 820 extern (C) Handle IDBObjectStore_openCursor_0(Handle, Handle); 821 extern (C) Handle IDBObjectStore_openCursor_1(Handle); 822 extern (C) Handle IDBObjectStore_openKeyCursor(Handle, Handle, IDBCursorDirection); 823 extern (C) Handle IDBObjectStore_openKeyCursor_0(Handle, Handle); 824 extern (C) Handle IDBObjectStore_openKeyCursor_1(Handle); 825 extern (C) Handle IDBObjectStore_index(Handle, string); 826 extern (C) Handle IDBObjectStore_createIndex(Handle, string, scope ref SumType!(string, Sequence!(string)), Handle); 827 extern (C) Handle IDBObjectStore_createIndex_0(Handle, string, scope ref SumType!(string, Sequence!(string))); 828 extern (C) void IDBObjectStore_deleteIndex(Handle, string); 829 extern (C) void IDBObjectStoreParameters_keyPath_Set(Handle, bool, scope ref SumType!(string, Sequence!(string))); 830 extern (C) Optional!(SumType!(string, Sequence!(string))) IDBObjectStoreParameters_keyPath_Get(Handle); 831 extern (C) void IDBObjectStoreParameters_autoIncrement_Set(Handle, bool); 832 extern (C) bool IDBObjectStoreParameters_autoIncrement_Get(Handle); 833 extern (C) void IDBOpenDBRequest_onblocked_Set(Handle, EventHandler); 834 extern (C) EventHandler IDBOpenDBRequest_onblocked_Get(Handle); 835 extern (C) void IDBOpenDBRequest_onupgradeneeded_Set(Handle, EventHandler); 836 extern (C) EventHandler IDBOpenDBRequest_onupgradeneeded_Get(Handle); 837 extern (C) Handle IDBRequest_result_Get(Handle); 838 extern (C) Optional!(DOMException) IDBRequest_error_Get(Handle); 839 extern (C) Optional!(SumType!(IDBObjectStore, IDBIndex, IDBCursor)) IDBRequest_source_Get(Handle); 840 extern (C) Optional!(IDBTransaction) IDBRequest_transaction_Get(Handle); 841 extern (C) IDBRequestReadyState IDBRequest_readyState_Get(Handle); 842 extern (C) void IDBRequest_onsuccess_Set(Handle, EventHandler); 843 extern (C) EventHandler IDBRequest_onsuccess_Get(Handle); 844 extern (C) void IDBRequest_onerror_Set(Handle, EventHandler); 845 extern (C) EventHandler IDBRequest_onerror_Get(Handle); 846 extern (C) Handle IDBTransaction_objectStoreNames_Get(Handle); 847 extern (C) IDBTransactionMode IDBTransaction_mode_Get(Handle); 848 extern (C) Handle IDBTransaction_db_Get(Handle); 849 extern (C) Handle IDBTransaction_error_Get(Handle); 850 extern (C) Handle IDBTransaction_objectStore(Handle, string); 851 extern (C) void IDBTransaction_abort(Handle); 852 extern (C) void IDBTransaction_onabort_Set(Handle, EventHandler); 853 extern (C) EventHandler IDBTransaction_onabort_Get(Handle); 854 extern (C) void IDBTransaction_oncomplete_Set(Handle, EventHandler); 855 extern (C) EventHandler IDBTransaction_oncomplete_Get(Handle); 856 extern (C) void IDBTransaction_onerror_Set(Handle, EventHandler); 857 extern (C) EventHandler IDBTransaction_onerror_Get(Handle); 858 extern (C) uint IDBVersionChangeEvent_oldVersion_Get(Handle); 859 extern (C) Optional!(uint) IDBVersionChangeEvent_newVersion_Get(Handle); 860 extern (C) void IDBVersionChangeEventInit_oldVersion_Set(Handle, uint); 861 extern (C) uint IDBVersionChangeEventInit_oldVersion_Get(Handle); 862 extern (C) void IDBVersionChangeEventInit_newVersion_Set(Handle, bool, uint); 863 extern (C) Optional!(uint) IDBVersionChangeEventInit_newVersion_Get(Handle);