package ezjs_idb

  1. Overview
  2. Docs

Source file ezjs_idb_types.ml

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
open Ezjs_min

type 'a listener = ('a -> unit) callback aopt

class type domException = object
  method code : int aopt readonly_prop
  method name : js_string t readonly_prop
  method message : js_string t readonly_prop
end

class type domStringList = object
  method length : int readonly_prop
  method item : int -> js_string t meth
  method contains : js_string t -> bool t meth
end

class type iDBVersionChangeEvent = object
  inherit Dom_html.event
  method oldVersion : int readonly_prop
  method newVersion : int readonly_prop
end

class type ['key] iDBKeyRange = object
  method lower : 'key readonly_prop
  method upper : 'key readonly_prop
  method lowerOpen : bool t readonly_prop
  method upperOpen : bool t readonly_prop
  method bound : 'key -> 'key -> bool t aopt -> bool t aopt -> 'key iDBKeyRange t meth
  method only : 'key -> 'key iDBKeyRange t meth
  method lowerBound : 'key -> bool t aopt -> 'key iDBKeyRange t meth
  method upperBound : 'key -> bool t aopt -> 'key iDBKeyRange t meth
  method includes : 'key -> bool t meth
end

class type create_index_options = object
  method unique : bool t aopt readonly_prop
  method multiEntry : bool t aopt readonly_prop
  method locale : bool t aopt readonly_prop
end

class type database_dict = object
  method name : js_string t readonly_prop
  method version : int readonly_prop
end

class type create_db_options = object
  method keyPath : js_string t aopt readonly_prop
  method autoIncrement : bool t aopt readonly_prop
end

class type iDBTransaction = object
  inherit Dom_html.eventTarget
  method db : 'db readonly_prop
  method error : domException t aopt readonly_prop
  method mode : js_string t readonly_prop
  method objectStoreNames : domStringList t readonly_prop
  method abort : unit meth
  method objectStore : js_string t -> 'objectStore meth
  method commit : unit meth
  method onabort : Dom_html.event t listener prop
  method oncomplete : Dom_html.event t listener prop
  method onerror : Dom_html.event t listener prop
end

class type ['result] iDBRequest = object
  inherit Dom_html.eventTarget
  method error : domException t aopt readonly_prop
  method result : 'result readonly_prop
  method source : 'source readonly_prop
  method readyState : js_string t readonly_prop
  method transaction : iDBTransaction t aopt readonly_prop
  method onerror : Dom_html.event t listener prop
  method onsuccess : Dom_html.event t listener prop
end

class type ['key, 'result] iDBCursor = object
  method source : 'source readonly_prop
  method direction : js_string t readonly_prop
  method key : 'key aopt readonly_prop
  method primaryKey : 'key aopt readonly_prop
  method request : 'result iDBRequest t readonly_prop
  method advance : int -> unit meth
  method continue : 'key aopt -> unit meth
  method continuePrimaryKey : 'key -> 'key -> unit meth
  method delete : unit aopt iDBRequest meth
  method update : 'result -> 'result iDBRequest meth
end

class type ['key, 'result] iDBCursorWithValue = object
  inherit ['key, 'result] iDBCursor
  method value : 'result readonly_prop
end

class type ['key, 'data] iDBIndex = object
  inherit Dom_html.eventTarget
  method isAutoLocale : bool t readonly_prop
  method locale : js_string t readonly_prop
  method name : js_string t prop
  method objectStore : 'objectStore readonly_prop
  method keyPath : js_string t aopt readonly_prop
  method multiEntry : bool t readonly_prop
  method unique : bool t readonly_prop
  method count : js_string t aopt -> int iDBRequest t meth
  method get : 'key aopt -> 'data aopt iDBRequest t meth
  method get_range : 'key iDBKeyRange t aopt -> 'data aopt iDBRequest t meth
  method getKey : 'key aopt -> 'key aopt iDBRequest t meth
  method getKey_range : 'key iDBKeyRange t aopt -> 'key aopt iDBRequest t meth
  method getAll : 'key aopt -> int aopt -> 'data js_array t iDBRequest t meth
  method getAll_range : 'key iDBKeyRange t aopt -> int aopt -> 'data js_array t iDBRequest t meth
  method getAllKeys : 'key aopt -> int aopt -> 'key js_array t iDBRequest t meth
  method getAllKeys_range : 'key iDBKeyRange t aopt -> int aopt -> 'key js_array t iDBRequest t meth
  method openCursor : 'key aopt -> js_string t aopt -> ('key, 'data) iDBCursorWithValue t aopt iDBRequest t meth
  method openCursor_range : 'key iDBKeyRange t aopt -> js_string t aopt -> ('key, 'data) iDBCursorWithValue t aopt iDBRequest t meth
  method openKeyCursor : 'key aopt -> js_string t aopt -> ('key, 'key) iDBCursor t aopt iDBRequest t meth
  method openKeyCursor_range : 'key iDBKeyRange t aopt -> js_string t aopt -> ('key, 'key) iDBCursor t aopt iDBRequest t meth
end

class type ['key, 'data] iDBObjectStore = object
  method indexNames : domStringList t readonly_prop
  method keyPath : js_string t aopt readonly_prop
  method name : js_string t prop
  method transaction : iDBTransaction t readonly_prop
  method autoIncrement : bool t readonly_prop
  method add : 'data -> 'key aopt -> 'key iDBRequest t meth
  method clear : unit aopt iDBRequest t meth
  method count : 'key aopt -> int iDBRequest t meth
  method count_range : 'key iDBKeyRange t aopt -> int iDBRequest t meth
  method createIndex : js_string t -> js_string t -> create_index_options t aopt -> ('key, 'data) iDBIndex t meth
  method delete : 'key -> unit aopt iDBRequest t meth
  method delete_range : 'key iDBKeyRange t -> unit aopt iDBRequest t meth
  method deleteIndex : js_string t -> unit aopt meth
  method get : 'key -> 'data aopt iDBRequest t meth
  method get_range : 'key iDBKeyRange t -> 'data aopt iDBRequest t meth
  method getKey : 'key -> 'key aopt iDBRequest t meth
  method getKey_range : 'key iDBKeyRange t -> 'key aopt iDBRequest t meth
  method getAll : 'key aopt -> int aopt -> 'data js_array t iDBRequest t meth
  method getAll_range : 'key iDBKeyRange t aopt -> int aopt -> 'data js_array t iDBRequest t meth
  method getAllKeys : 'key aopt -> int aopt -> 'key js_array t iDBRequest t meth
  method getAllKeys_range : 'key iDBKeyRange t aopt -> int aopt -> 'key js_array t iDBRequest t meth
  method index : js_string t -> ('key, 'data) iDBIndex t meth
  method openCursor : 'key aopt -> js_string t aopt -> ('key, 'data) iDBCursorWithValue t aopt iDBRequest t meth
  method openCursor_range : 'key iDBKeyRange t aopt -> js_string t aopt -> ('key, 'data) iDBCursorWithValue t aopt iDBRequest t meth
  method openKeyCursor : 'key aopt -> js_string t aopt -> ('key, 'key) iDBCursor t aopt iDBRequest t meth
  method openKeyCursor_range : 'key iDBKeyRange t aopt -> js_string t aopt -> ('key, 'key) iDBCursor t aopt iDBRequest t meth
  method put : 'data -> 'key aopt -> 'data iDBRequest t meth
end

class type iDBDatabase = object
  inherit Dom_html.eventTarget
  method name : js_string t readonly_prop
  method version : int readonly_prop
  method objectStoreNames : domStringList t readonly_prop
  method close : unit meth
  method createMutableFile : js_string t -> File.file t meth
  method createObjectStore : js_string t -> create_db_options t aopt -> (Unsafe.any, Unsafe.any) iDBObjectStore t meth
  method deleteObjectStore : js_string t -> unit meth
  method transaction : js_string t js_array t -> js_string t aopt -> iDBTransaction t meth
  method onabort : Dom_html.event t listener prop
  method onclose : Dom_html.event t listener prop
  method onerror : Dom_html.event t listener prop
  method onversionchange : iDBVersionChangeEvent t listener prop
end

class type ['result] iDBOpenDBRequest = object
  inherit ['result] iDBRequest
  method onblocked : Dom_html.event t listener prop
  method onupgradeneeded : iDBVersionChangeEvent t listener prop
end

class type ['key] iDBFactory = object
  method _open : js_string t -> int aopt -> iDBDatabase t iDBOpenDBRequest t meth
  method deleteDatabase : js_string t -> int aopt -> unit aopt iDBOpenDBRequest t meth
  method cmp : 'key -> 'key -> int meth
  method databases : database_dict t meth
end

class type ['key] iDBEnvironment = object
  method indexedDB : 'key iDBFactory t readonly_prop
end

class type ['key] iDBLocaleAwareKeyRange = object (* firefox only *)
  inherit ['key] iDBKeyRange
end