1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
use super::*;
/// The IDBObjectStore class.
/// [`IDBObjectStore`](https://developer.mozilla.org/en-US/docs/Web/API/IDBObjectStore)
#[derive(Clone, Debug, PartialEq, PartialOrd)]
#[repr(transparent)]
pub struct IDBObjectStore {
inner: Any,
}
impl FromVal for IDBObjectStore {
fn from_val(v: &Any) -> Self {
IDBObjectStore {
inner: Any::from_val(v),
}
}
fn take_ownership(v: AnyHandle) -> Self {
Self::from_val(&Any::take_ownership(v))
}
fn as_handle(&self) -> AnyHandle {
self.inner.as_handle()
}
}
impl core::ops::Deref for IDBObjectStore {
type Target = Any;
fn deref(&self) -> &Self::Target {
&self.inner
}
}
impl core::ops::DerefMut for IDBObjectStore {
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.inner
}
}
impl AsRef<Any> for IDBObjectStore {
fn as_ref(&self) -> &Any {
&self.inner
}
}
impl AsMut<Any> for IDBObjectStore {
fn as_mut(&mut self) -> &mut Any {
&mut self.inner
}
}
impl From<IDBObjectStore> for Any {
fn from(s: IDBObjectStore) -> Any {
let handle = s.inner.as_handle();
core::mem::forget(s);
Any::take_ownership(handle)
}
}
impl From<&IDBObjectStore> for Any {
fn from(s: &IDBObjectStore) -> Any {
s.inner.clone().into()
}
}
jsbind::utils::impl_dyn_cast!(IDBObjectStore);
impl IDBObjectStore {
/// Getter of the `name` attribute.
/// [`IDBObjectStore.name`](https://developer.mozilla.org/en-US/docs/Web/API/IDBObjectStore/name)
pub fn name(&self) -> JsString {
self.inner.get("name").as_::<JsString>()
}
/// Setter of the `name` attribute.
/// [`IDBObjectStore.name`](https://developer.mozilla.org/en-US/docs/Web/API/IDBObjectStore/name)
pub fn set_name(&mut self, value: &JsString) {
self.inner.set("name", value);
}
}
impl IDBObjectStore {
/// Getter of the `keyPath` attribute.
/// [`IDBObjectStore.keyPath`](https://developer.mozilla.org/en-US/docs/Web/API/IDBObjectStore/keyPath)
pub fn key_path(&self) -> Any {
self.inner.get("keyPath").as_::<Any>()
}
}
impl IDBObjectStore {
/// Getter of the `indexNames` attribute.
/// [`IDBObjectStore.indexNames`](https://developer.mozilla.org/en-US/docs/Web/API/IDBObjectStore/indexNames)
pub fn index_names(&self) -> DOMStringList {
self.inner.get("indexNames").as_::<DOMStringList>()
}
}
impl IDBObjectStore {
/// Getter of the `transaction` attribute.
/// [`IDBObjectStore.transaction`](https://developer.mozilla.org/en-US/docs/Web/API/IDBObjectStore/transaction)
pub fn transaction(&self) -> IDBTransaction {
self.inner.get("transaction").as_::<IDBTransaction>()
}
}
impl IDBObjectStore {
/// Getter of the `autoIncrement` attribute.
/// [`IDBObjectStore.autoIncrement`](https://developer.mozilla.org/en-US/docs/Web/API/IDBObjectStore/autoIncrement)
pub fn auto_increment(&self) -> bool {
self.inner.get("autoIncrement").as_::<bool>()
}
}
impl IDBObjectStore {
/// The put method.
/// [`IDBObjectStore.put`](https://developer.mozilla.org/en-US/docs/Web/API/IDBObjectStore/put)
pub fn put(&self, value: &Any) -> IDBRequest {
self.inner.call("put", &[value.into()]).as_::<IDBRequest>()
}
}
impl IDBObjectStore {
/// The put method.
/// [`IDBObjectStore.put`](https://developer.mozilla.org/en-US/docs/Web/API/IDBObjectStore/put)
pub fn put_with_key(&self, value: &Any, key: &Any) -> IDBRequest {
self.inner
.call("put", &[value.into(), key.into()])
.as_::<IDBRequest>()
}
}
impl IDBObjectStore {
/// The add method.
/// [`IDBObjectStore.add`](https://developer.mozilla.org/en-US/docs/Web/API/IDBObjectStore/add)
pub fn add(&self, value: &Any) -> IDBRequest {
self.inner.call("add", &[value.into()]).as_::<IDBRequest>()
}
}
impl IDBObjectStore {
/// The add method.
/// [`IDBObjectStore.add`](https://developer.mozilla.org/en-US/docs/Web/API/IDBObjectStore/add)
pub fn add_with_key(&self, value: &Any, key: &Any) -> IDBRequest {
self.inner
.call("add", &[value.into(), key.into()])
.as_::<IDBRequest>()
}
}
impl IDBObjectStore {
/// The delete method.
/// [`IDBObjectStore.delete`](https://developer.mozilla.org/en-US/docs/Web/API/IDBObjectStore/delete)
pub fn delete(&self, query: &Any) -> IDBRequest {
self.inner
.call("delete", &[query.into()])
.as_::<IDBRequest>()
}
}
impl IDBObjectStore {
/// The clear method.
/// [`IDBObjectStore.clear`](https://developer.mozilla.org/en-US/docs/Web/API/IDBObjectStore/clear)
pub fn clear(&self) -> IDBRequest {
self.inner.call("clear", &[]).as_::<IDBRequest>()
}
}
impl IDBObjectStore {
/// The get method.
/// [`IDBObjectStore.get`](https://developer.mozilla.org/en-US/docs/Web/API/IDBObjectStore/get)
pub fn get(&self, query: &Any) -> IDBRequest {
self.inner.call("get", &[query.into()]).as_::<IDBRequest>()
}
}
impl IDBObjectStore {
/// The getKey method.
/// [`IDBObjectStore.getKey`](https://developer.mozilla.org/en-US/docs/Web/API/IDBObjectStore/getKey)
pub fn get_key(&self, query: &Any) -> IDBRequest {
self.inner
.call("getKey", &[query.into()])
.as_::<IDBRequest>()
}
}
impl IDBObjectStore {
/// The getAll method.
/// [`IDBObjectStore.getAll`](https://developer.mozilla.org/en-US/docs/Web/API/IDBObjectStore/getAll)
pub fn get_all(&self) -> IDBRequest {
self.inner.call("getAll", &[]).as_::<IDBRequest>()
}
}
impl IDBObjectStore {
/// The getAll method.
/// [`IDBObjectStore.getAll`](https://developer.mozilla.org/en-US/docs/Web/API/IDBObjectStore/getAll)
pub fn get_all_with_query_or_options(&self, query_or_options: &Any) -> IDBRequest {
self.inner
.call("getAll", &[query_or_options.into()])
.as_::<IDBRequest>()
}
}
impl IDBObjectStore {
/// The getAll method.
/// [`IDBObjectStore.getAll`](https://developer.mozilla.org/en-US/docs/Web/API/IDBObjectStore/getAll)
pub fn get_all_with_query_or_options_and_count(
&self,
query_or_options: &Any,
count: u32,
) -> IDBRequest {
self.inner
.call("getAll", &[query_or_options.into(), count.into()])
.as_::<IDBRequest>()
}
}
impl IDBObjectStore {
/// The getAllKeys method.
/// [`IDBObjectStore.getAllKeys`](https://developer.mozilla.org/en-US/docs/Web/API/IDBObjectStore/getAllKeys)
pub fn get_all_keys(&self) -> IDBRequest {
self.inner.call("getAllKeys", &[]).as_::<IDBRequest>()
}
}
impl IDBObjectStore {
/// The getAllKeys method.
/// [`IDBObjectStore.getAllKeys`](https://developer.mozilla.org/en-US/docs/Web/API/IDBObjectStore/getAllKeys)
pub fn get_all_keys_with_query_or_options(&self, query_or_options: &Any) -> IDBRequest {
self.inner
.call("getAllKeys", &[query_or_options.into()])
.as_::<IDBRequest>()
}
}
impl IDBObjectStore {
/// The getAllKeys method.
/// [`IDBObjectStore.getAllKeys`](https://developer.mozilla.org/en-US/docs/Web/API/IDBObjectStore/getAllKeys)
pub fn get_all_keys_with_query_or_options_and_count(
&self,
query_or_options: &Any,
count: u32,
) -> IDBRequest {
self.inner
.call("getAllKeys", &[query_or_options.into(), count.into()])
.as_::<IDBRequest>()
}
}
impl IDBObjectStore {
/// The getAllRecords method.
/// [`IDBObjectStore.getAllRecords`](https://developer.mozilla.org/en-US/docs/Web/API/IDBObjectStore/getAllRecords)
pub fn get_all_records(&self) -> IDBRequest {
self.inner.call("getAllRecords", &[]).as_::<IDBRequest>()
}
}
impl IDBObjectStore {
/// The getAllRecords method.
/// [`IDBObjectStore.getAllRecords`](https://developer.mozilla.org/en-US/docs/Web/API/IDBObjectStore/getAllRecords)
pub fn get_all_records_with_options(&self, options: &IDBGetAllOptions) -> IDBRequest {
self.inner
.call("getAllRecords", &[options.into()])
.as_::<IDBRequest>()
}
}
impl IDBObjectStore {
/// The count method.
/// [`IDBObjectStore.count`](https://developer.mozilla.org/en-US/docs/Web/API/IDBObjectStore/count)
pub fn count(&self) -> IDBRequest {
self.inner.call("count", &[]).as_::<IDBRequest>()
}
}
impl IDBObjectStore {
/// The count method.
/// [`IDBObjectStore.count`](https://developer.mozilla.org/en-US/docs/Web/API/IDBObjectStore/count)
pub fn count_with_query(&self, query: &Any) -> IDBRequest {
self.inner
.call("count", &[query.into()])
.as_::<IDBRequest>()
}
}
impl IDBObjectStore {
/// The openCursor method.
/// [`IDBObjectStore.openCursor`](https://developer.mozilla.org/en-US/docs/Web/API/IDBObjectStore/openCursor)
pub fn open_cursor(&self) -> IDBRequest {
self.inner.call("openCursor", &[]).as_::<IDBRequest>()
}
}
impl IDBObjectStore {
/// The openCursor method.
/// [`IDBObjectStore.openCursor`](https://developer.mozilla.org/en-US/docs/Web/API/IDBObjectStore/openCursor)
pub fn open_cursor_with_query(&self, query: &Any) -> IDBRequest {
self.inner
.call("openCursor", &[query.into()])
.as_::<IDBRequest>()
}
}
impl IDBObjectStore {
/// The openCursor method.
/// [`IDBObjectStore.openCursor`](https://developer.mozilla.org/en-US/docs/Web/API/IDBObjectStore/openCursor)
pub fn open_cursor_with_query_and_direction(
&self,
query: &Any,
direction: &IDBCursorDirection,
) -> IDBRequest {
self.inner
.call("openCursor", &[query.into(), direction.into()])
.as_::<IDBRequest>()
}
}
impl IDBObjectStore {
/// The openKeyCursor method.
/// [`IDBObjectStore.openKeyCursor`](https://developer.mozilla.org/en-US/docs/Web/API/IDBObjectStore/openKeyCursor)
pub fn open_key_cursor(&self) -> IDBRequest {
self.inner.call("openKeyCursor", &[]).as_::<IDBRequest>()
}
}
impl IDBObjectStore {
/// The openKeyCursor method.
/// [`IDBObjectStore.openKeyCursor`](https://developer.mozilla.org/en-US/docs/Web/API/IDBObjectStore/openKeyCursor)
pub fn open_key_cursor_with_query(&self, query: &Any) -> IDBRequest {
self.inner
.call("openKeyCursor", &[query.into()])
.as_::<IDBRequest>()
}
}
impl IDBObjectStore {
/// The openKeyCursor method.
/// [`IDBObjectStore.openKeyCursor`](https://developer.mozilla.org/en-US/docs/Web/API/IDBObjectStore/openKeyCursor)
pub fn open_key_cursor_with_query_and_direction(
&self,
query: &Any,
direction: &IDBCursorDirection,
) -> IDBRequest {
self.inner
.call("openKeyCursor", &[query.into(), direction.into()])
.as_::<IDBRequest>()
}
}
impl IDBObjectStore {
/// The index method.
/// [`IDBObjectStore.index`](https://developer.mozilla.org/en-US/docs/Web/API/IDBObjectStore/index)
pub fn index(&self, name: &JsString) -> IDBIndex {
self.inner.call("index", &[name.into()]).as_::<IDBIndex>()
}
}
impl IDBObjectStore {
/// The createIndex method.
/// [`IDBObjectStore.createIndex`](https://developer.mozilla.org/en-US/docs/Web/API/IDBObjectStore/createIndex)
pub fn create_index(&self, name: &JsString, key_path: &Any) -> IDBIndex {
self.inner
.call("createIndex", &[name.into(), key_path.into()])
.as_::<IDBIndex>()
}
}
impl IDBObjectStore {
/// The createIndex method.
/// [`IDBObjectStore.createIndex`](https://developer.mozilla.org/en-US/docs/Web/API/IDBObjectStore/createIndex)
pub fn create_index_with_options(
&self,
name: &JsString,
key_path: &Any,
options: &IDBIndexParameters,
) -> IDBIndex {
self.inner
.call(
"createIndex",
&[name.into(), key_path.into(), options.into()],
)
.as_::<IDBIndex>()
}
}
impl IDBObjectStore {
/// The deleteIndex method.
/// [`IDBObjectStore.deleteIndex`](https://developer.mozilla.org/en-US/docs/Web/API/IDBObjectStore/deleteIndex)
pub fn delete_index(&self, name: &JsString) -> Undefined {
self.inner
.call("deleteIndex", &[name.into()])
.as_::<Undefined>()
}
}