ObjectStore.hx 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. /*
  2. * Copyright (C)2005-2018 Haxe Foundation
  3. *
  4. * Permission is hereby granted, free of charge, to any person obtaining a
  5. * copy of this software and associated documentation files (the "Software"),
  6. * to deal in the Software without restriction, including without limitation
  7. * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  8. * and/or sell copies of the Software, and to permit persons to whom the
  9. * Software is furnished to do so, subject to the following conditions:
  10. *
  11. * The above copyright notice and this permission notice shall be included in
  12. * all copies or substantial portions of the Software.
  13. *
  14. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  19. * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  20. * DEALINGS IN THE SOFTWARE.
  21. */
  22. // This file is generated from mozilla\IDBObjectStore.webidl. Do not edit!
  23. package js.html.idb;
  24. /**
  25. This example shows a variety of different uses of object stores, from updating the data structure with `IDBObjectStore.createIndex` inside an `onupgradeneeded` function, to adding a new item to our object store with `IDBObjectStore.add`. For a full working example, see our To-do Notifications app (view example live.)
  26. Documentation [IDBObjectStore](https://developer.mozilla.org/en-US/docs/Web/API/IDBObjectStore) by [Mozilla Contributors](https://developer.mozilla.org/en-US/docs/Web/API/IDBObjectStore$history), licensed under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/).
  27. @see <https://developer.mozilla.org/en-US/docs/Web/API/IDBObjectStore>
  28. **/
  29. @:native("IDBObjectStore")
  30. extern class ObjectStore
  31. {
  32. /**
  33. The name of this object store.
  34. **/
  35. var name : String;
  36. /**
  37. The key path of this object store. If this attribute is `null`, the application must provide a key for each modification operation.
  38. **/
  39. var keyPath(default,null) : Dynamic;
  40. /**
  41. A list of the names of indexes on objects in this object store.
  42. **/
  43. var indexNames(default,null) : js.html.DOMStringList;
  44. /**
  45. The `IDBTransaction` object to which this object store belongs.
  46. **/
  47. var transaction(default,null) : Transaction;
  48. /**
  49. The value of the auto increment flag for this object store.
  50. **/
  51. var autoIncrement(default,null) : Bool;
  52. /**
  53. Returns an `IDBRequest` object, and, in a separate thread, creates a structured clone of the `value`, and stores the cloned value in the object store. This is for updating existing records in an object store when the transaction's mode is `readwrite`.
  54. @throws DOMError
  55. **/
  56. function put( value : Dynamic, ?key : Dynamic ) : Request;
  57. /**
  58. Returns an `IDBRequest` object, and, in a separate thread, creates a structured clone of the `value`, and stores the cloned value in the object store. This is for adding new records to an object store.
  59. @throws DOMError
  60. **/
  61. function add( value : Dynamic, ?key : Dynamic ) : Request;
  62. /**
  63. returns an `IDBRequest` object, and, in a separate thread, deletes the store object selected by the specified key. This is for deleting individual records out of an object store.
  64. @throws DOMError
  65. **/
  66. function delete( key : Dynamic ) : Request;
  67. /**
  68. Returns an `IDBRequest` object, and, in a separate thread, returns the store object store selected by the specified key. This is for retrieving specific records from an object store.
  69. @throws DOMError
  70. **/
  71. function get( key : Dynamic ) : Request;
  72. /**
  73. Returns an `IDBRequest` object, and, in a separate thread retrieves and returns the record key for the object in the object stored matching the specified parameter.
  74. @throws DOMError
  75. **/
  76. function getKey( key : Dynamic ) : Request;
  77. /**
  78. Creates and immediately returns an `IDBRequest` object, and clears this object store in a separate thread. This is for deleting all current records out of an object store.
  79. @throws DOMError
  80. **/
  81. function clear() : Request;
  82. /**
  83. Returns an `IDBRequest` object, and, in a separate thread, returns a new `IDBCursorWithValue` object. Used for iterating through an object store by primary key with a cursor.
  84. @throws DOMError
  85. **/
  86. function openCursor( ?range : Dynamic, ?direction : CursorDirection = "next" ) : Request;
  87. /**
  88. Creates a new index during a version upgrade, returning a new `IDBIndex` object in the connected database.
  89. @throws DOMError
  90. **/
  91. @:overload( function( name : String, keyPath : Array<String>, ?optionalParameters : IndexParameters) : Index {} )
  92. function createIndex( name : String, keyPath : String, ?optionalParameters : IndexParameters ) : Index;
  93. /**
  94. Opens an index from this object store after which it can, for example, be used to return a sequence of records sorted by that index using a cursor.
  95. @throws DOMError
  96. **/
  97. function index( name : String ) : Index;
  98. /**
  99. Destroys the specified index in the connected database, used during a version upgrade.
  100. @throws DOMError
  101. **/
  102. function deleteIndex( indexName : String ) : Void;
  103. /**
  104. Returns an `IDBRequest` object, and, in a separate thread, returns the total number of records that match the provided key or `IDBKeyRange`. If no arguments are provided, it returns the total number of records in the store.
  105. @throws DOMError
  106. **/
  107. function count( ?key : Dynamic ) : Request;
  108. /**
  109. Returns an `IDBRequest` object retrieves all objects in the object store matching the specified parameter or all objects in the store if no parameters are given.
  110. @throws DOMError
  111. **/
  112. function getAll( ?key : Dynamic, ?limit : Int ) : Request;
  113. /**
  114. Returns an `IDBRequest` object retrieves record keys for all objects in the object store matching the specified parameter or all objects in the store if no parameters are given.
  115. @throws DOMError
  116. **/
  117. function getAllKeys( ?key : Dynamic, ?limit : Int ) : Request;
  118. /**
  119. Returns an `IDBRequest` object, and, in a separate thread, returns a new `IDBCursor`. Used for iterating through an object store with a key.
  120. @throws DOMError
  121. **/
  122. function openKeyCursor( ?range : Dynamic, ?direction : CursorDirection = "next" ) : Request;
  123. }