1 | <!DOCTYPE html>
|
2 | <html lang="en">
|
3 | <head>
|
4 | <meta charset="utf-8">
|
5 | <title>JSDoc: Class: LokiIndexedAdapter</title>
|
6 |
|
7 | <script src="scripts/prettify/prettify.js"> </script>
|
8 | <script src="scripts/prettify/lang-css.js"> </script>
|
9 | |
10 |
|
11 |
|
12 | <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
|
13 | <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
|
14 | </head>
|
15 |
|
16 | <body>
|
17 |
|
18 | <div id="main">
|
19 |
|
20 | <h1 class="page-title">Class: LokiIndexedAdapter</h1>
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 | <section>
|
28 |
|
29 | <header>
|
30 |
|
31 | <h2>LokiIndexedAdapter</h2>
|
32 |
|
33 |
|
34 | </header>
|
35 |
|
36 | <article>
|
37 | <div class="container-overview">
|
38 |
|
39 |
|
40 |
|
41 |
|
42 |
|
43 | <h4 class="name" id="LokiIndexedAdapter"><span class="type-signature"></span>new LokiIndexedAdapter<span class="signature">(appname)</span><span class="type-signature"></span></h4>
|
44 |
|
45 |
|
46 |
|
47 |
|
48 |
|
49 | <div class="description">
|
50 | <p>Loki persistence adapter class for indexedDb.
|
51 | This class fulfills abstract adapter interface which can be applied to other storage methods.
|
52 | Utilizes the included LokiCatalog app/key/value database for actual database persistence.
|
53 | Indexeddb is highly async, but this adapter has been made 'console-friendly' as well.
|
54 | Anywhere a callback is omitted, it should return results (if applicable) to console.
|
55 | IndexedDb storage is provided per-domain, so we implement app/key/value database to
|
56 | allow separate contexts for separate apps within a domain.</p>
|
57 | </div>
|
58 |
|
59 |
|
60 |
|
61 |
|
62 |
|
63 |
|
64 |
|
65 |
|
66 |
|
67 | <h5>Parameters:</h5>
|
68 |
|
69 |
|
70 | <table class="params">
|
71 | <thead>
|
72 | <tr>
|
73 |
|
74 | <th>Name</th>
|
75 |
|
76 |
|
77 | <th>Type</th>
|
78 |
|
79 |
|
80 |
|
81 |
|
82 |
|
83 | <th class="last">Description</th>
|
84 | </tr>
|
85 | </thead>
|
86 |
|
87 | <tbody>
|
88 |
|
89 |
|
90 | <tr>
|
91 |
|
92 | <td class="name"><code>appname</code></td>
|
93 |
|
94 |
|
95 | <td class="type">
|
96 |
|
97 |
|
98 | <span class="param-type">string</span>
|
99 |
|
100 |
|
101 |
|
102 | </td>
|
103 |
|
104 |
|
105 |
|
106 |
|
107 |
|
108 | <td class="description last"><p>(Optional) Application name context can be used to distinguish subdomains, 'loki' by default</p></td>
|
109 | </tr>
|
110 |
|
111 |
|
112 | </tbody>
|
113 | </table>
|
114 |
|
115 |
|
116 |
|
117 |
|
118 |
|
119 |
|
120 | <dl class="details">
|
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 | <dt class="tag-source">Source:</dt>
|
148 | <dd class="tag-source"><ul class="dummy"><li>
|
149 | <a href="loki-indexed-adapter.js.html">loki-indexed-adapter.js</a>, <a href="loki-indexed-adapter.js.html#line25">line 25</a>
|
150 | </li></ul></dd>
|
151 |
|
152 |
|
153 |
|
154 |
|
155 |
|
156 |
|
157 |
|
158 | </dl>
|
159 |
|
160 |
|
161 |
|
162 |
|
163 |
|
164 |
|
165 |
|
166 |
|
167 |
|
168 |
|
169 |
|
170 |
|
171 |
|
172 |
|
173 |
|
174 | <h5>Example</h5>
|
175 |
|
176 | <pre class="prettyprint"><code>var idbAdapter = new LokiIndexedAdapter('finance');</code></pre>
|
177 |
|
178 |
|
179 |
|
180 |
|
181 | </div>
|
182 |
|
183 |
|
184 |
|
185 |
|
186 |
|
187 |
|
188 |
|
189 |
|
190 |
|
191 |
|
192 |
|
193 |
|
194 |
|
195 |
|
196 | <h3 class="subsection-title">Methods</h3>
|
197 |
|
198 |
|
199 |
|
200 |
|
201 |
|
202 |
|
203 | <h4 class="name" id="checkAvailability"><span class="type-signature"></span>checkAvailability<span class="signature">()</span><span class="type-signature"> → {boolean}</span></h4>
|
204 |
|
205 |
|
206 |
|
207 |
|
208 |
|
209 | <div class="description">
|
210 | <p>Used to check if adapter is available</p>
|
211 | </div>
|
212 |
|
213 |
|
214 |
|
215 |
|
216 |
|
217 |
|
218 |
|
219 |
|
220 |
|
221 |
|
222 |
|
223 |
|
224 |
|
225 | <dl class="details">
|
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 | <dt class="tag-source">Source:</dt>
|
253 | <dd class="tag-source"><ul class="dummy"><li>
|
254 | <a href="loki-indexed-adapter.js.html">loki-indexed-adapter.js</a>, <a href="loki-indexed-adapter.js.html#line64">line 64</a>
|
255 | </li></ul></dd>
|
256 |
|
257 |
|
258 |
|
259 |
|
260 |
|
261 |
|
262 |
|
263 | </dl>
|
264 |
|
265 |
|
266 |
|
267 |
|
268 |
|
269 |
|
270 |
|
271 |
|
272 |
|
273 |
|
274 |
|
275 |
|
276 |
|
277 | <h5>Returns:</h5>
|
278 |
|
279 |
|
280 | <div class="param-desc">
|
281 | <p>true if indexeddb is available, false if not.</p>
|
282 | </div>
|
283 |
|
284 |
|
285 |
|
286 | <dl>
|
287 | <dt>
|
288 | Type
|
289 | </dt>
|
290 | <dd>
|
291 |
|
292 | <span class="param-type">boolean</span>
|
293 |
|
294 |
|
295 | </dd>
|
296 | </dl>
|
297 |
|
298 |
|
299 |
|
300 |
|
301 |
|
302 |
|
303 |
|
304 |
|
305 |
|
306 |
|
307 | <h4 class="name" id="deleteDatabase"><span class="type-signature"></span>deleteDatabase<span class="signature">(dbname, callback<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></h4>
|
308 |
|
309 |
|
310 |
|
311 |
|
312 |
|
313 | <div class="description">
|
314 | <p>Deletes a serialized db from the catalog.</p>
|
315 | </div>
|
316 |
|
317 |
|
318 |
|
319 |
|
320 |
|
321 |
|
322 |
|
323 |
|
324 |
|
325 | <h5>Parameters:</h5>
|
326 |
|
327 |
|
328 | <table class="params">
|
329 | <thead>
|
330 | <tr>
|
331 |
|
332 | <th>Name</th>
|
333 |
|
334 |
|
335 | <th>Type</th>
|
336 |
|
337 |
|
338 | <th>Attributes</th>
|
339 |
|
340 |
|
341 |
|
342 |
|
343 | <th class="last">Description</th>
|
344 | </tr>
|
345 | </thead>
|
346 |
|
347 | <tbody>
|
348 |
|
349 |
|
350 | <tr>
|
351 |
|
352 | <td class="name"><code>dbname</code></td>
|
353 |
|
354 |
|
355 | <td class="type">
|
356 |
|
357 |
|
358 | <span class="param-type">string</span>
|
359 |
|
360 |
|
361 |
|
362 | </td>
|
363 |
|
364 |
|
365 | <td class="attributes">
|
366 |
|
367 |
|
368 |
|
369 |
|
370 |
|
371 | </td>
|
372 |
|
373 |
|
374 |
|
375 |
|
376 | <td class="description last"><p>the name of the database to delete from the catalog.</p></td>
|
377 | </tr>
|
378 |
|
379 |
|
380 |
|
381 | <tr>
|
382 |
|
383 | <td class="name"><code>callback</code></td>
|
384 |
|
385 |
|
386 | <td class="type">
|
387 |
|
388 |
|
389 | <span class="param-type">function</span>
|
390 |
|
391 |
|
392 |
|
393 | </td>
|
394 |
|
395 |
|
396 | <td class="attributes">
|
397 |
|
398 | <optional><br>
|
399 |
|
400 |
|
401 |
|
402 |
|
403 |
|
404 | </td>
|
405 |
|
406 |
|
407 |
|
408 |
|
409 | <td class="description last"><p>(Optional) executed on database delete</p></td>
|
410 | </tr>
|
411 |
|
412 |
|
413 | </tbody>
|
414 | </table>
|
415 |
|
416 |
|
417 |
|
418 |
|
419 |
|
420 |
|
421 | <dl class="details">
|
422 |
|
423 |
|
424 |
|
425 |
|
426 |
|
427 |
|
428 |
|
429 |
|
430 |
|
431 |
|
432 |
|
433 |
|
434 |
|
435 |
|
436 |
|
437 |
|
438 |
|
439 |
|
440 |
|
441 |
|
442 |
|
443 |
|
444 |
|
445 |
|
446 |
|
447 |
|
448 | <dt class="tag-source">Source:</dt>
|
449 | <dd class="tag-source"><ul class="dummy"><li>
|
450 | <a href="loki-indexed-adapter.js.html">loki-indexed-adapter.js</a>, <a href="loki-indexed-adapter.js.html#line184">line 184</a>
|
451 | </li></ul></dd>
|
452 |
|
453 |
|
454 |
|
455 |
|
456 |
|
457 |
|
458 |
|
459 | </dl>
|
460 |
|
461 |
|
462 |
|
463 |
|
464 |
|
465 |
|
466 |
|
467 |
|
468 |
|
469 |
|
470 |
|
471 |
|
472 |
|
473 |
|
474 |
|
475 | <h5>Example</h5>
|
476 |
|
477 | <pre class="prettyprint"><code>// DELETE DATABASE
// delete 'finance'/'test' value from catalog
idbAdapter.deleteDatabase('test', function {
// database deleted
});</code></pre>
|
478 |
|
479 |
|
480 |
|
481 |
|
482 |
|
483 |
|
484 |
|
485 |
|
486 | <h4 class="name" id="deleteDatabasePartitions"><span class="type-signature"></span>deleteDatabasePartitions<span class="signature">(dbname)</span><span class="type-signature"></span></h4>
|
487 |
|
488 |
|
489 |
|
490 |
|
491 |
|
492 | <div class="description">
|
493 | <p>Removes all database partitions and pages with the base filename passed in.
|
494 | This utility method does not (yet) guarantee async deletions will be completed before returning</p>
|
495 | </div>
|
496 |
|
497 |
|
498 |
|
499 |
|
500 |
|
501 |
|
502 |
|
503 |
|
504 |
|
505 | <h5>Parameters:</h5>
|
506 |
|
507 |
|
508 | <table class="params">
|
509 | <thead>
|
510 | <tr>
|
511 |
|
512 | <th>Name</th>
|
513 |
|
514 |
|
515 | <th>Type</th>
|
516 |
|
517 |
|
518 |
|
519 |
|
520 |
|
521 | <th class="last">Description</th>
|
522 | </tr>
|
523 | </thead>
|
524 |
|
525 | <tbody>
|
526 |
|
527 |
|
528 | <tr>
|
529 |
|
530 | <td class="name"><code>dbname</code></td>
|
531 |
|
532 |
|
533 | <td class="type">
|
534 |
|
535 |
|
536 | <span class="param-type">string</span>
|
537 |
|
538 |
|
539 |
|
540 | </td>
|
541 |
|
542 |
|
543 |
|
544 |
|
545 |
|
546 | <td class="description last"><p>the base filename which container, partitions, or pages are derived</p></td>
|
547 | </tr>
|
548 |
|
549 |
|
550 | </tbody>
|
551 | </table>
|
552 |
|
553 |
|
554 |
|
555 |
|
556 |
|
557 |
|
558 | <dl class="details">
|
559 |
|
560 |
|
561 |
|
562 |
|
563 |
|
564 |
|
565 |
|
566 |
|
567 |
|
568 |
|
569 |
|
570 |
|
571 |
|
572 |
|
573 |
|
574 |
|
575 |
|
576 |
|
577 |
|
578 |
|
579 |
|
580 |
|
581 |
|
582 |
|
583 |
|
584 |
|
585 | <dt class="tag-source">Source:</dt>
|
586 | <dd class="tag-source"><ul class="dummy"><li>
|
587 | <a href="loki-indexed-adapter.js.html">loki-indexed-adapter.js</a>, <a href="loki-indexed-adapter.js.html#line224">line 224</a>
|
588 | </li></ul></dd>
|
589 |
|
590 |
|
591 |
|
592 |
|
593 |
|
594 |
|
595 |
|
596 | </dl>
|
597 |
|
598 |
|
599 |
|
600 |
|
601 |
|
602 |
|
603 |
|
604 |
|
605 |
|
606 |
|
607 |
|
608 |
|
609 |
|
610 |
|
611 |
|
612 |
|
613 |
|
614 |
|
615 |
|
616 |
|
617 |
|
618 | <h4 class="name" id="getCatalogSummary"><span class="type-signature"></span>getCatalogSummary<span class="signature">(callback)</span><span class="type-signature"></span></h4>
|
619 |
|
620 |
|
621 |
|
622 |
|
623 |
|
624 | <div class="description">
|
625 | <p>Allows retrieval of list of all keys in catalog along with size</p>
|
626 | </div>
|
627 |
|
628 |
|
629 |
|
630 |
|
631 |
|
632 |
|
633 |
|
634 |
|
635 |
|
636 | <h5>Parameters:</h5>
|
637 |
|
638 |
|
639 | <table class="params">
|
640 | <thead>
|
641 | <tr>
|
642 |
|
643 | <th>Name</th>
|
644 |
|
645 |
|
646 | <th>Type</th>
|
647 |
|
648 |
|
649 |
|
650 |
|
651 |
|
652 | <th class="last">Description</th>
|
653 | </tr>
|
654 | </thead>
|
655 |
|
656 | <tbody>
|
657 |
|
658 |
|
659 | <tr>
|
660 |
|
661 | <td class="name"><code>callback</code></td>
|
662 |
|
663 |
|
664 | <td class="type">
|
665 |
|
666 |
|
667 | <span class="param-type">function</span>
|
668 |
|
669 |
|
670 |
|
671 | </td>
|
672 |
|
673 |
|
674 |
|
675 |
|
676 |
|
677 | <td class="description last"><p>(Optional) callback to accept result array.</p></td>
|
678 | </tr>
|
679 |
|
680 |
|
681 | </tbody>
|
682 | </table>
|
683 |
|
684 |
|
685 |
|
686 |
|
687 |
|
688 |
|
689 | <dl class="details">
|
690 |
|
691 |
|
692 |
|
693 |
|
694 |
|
695 |
|
696 |
|
697 |
|
698 |
|
699 |
|
700 |
|
701 |
|
702 |
|
703 |
|
704 |
|
705 |
|
706 |
|
707 |
|
708 |
|
709 |
|
710 |
|
711 |
|
712 |
|
713 |
|
714 |
|
715 |
|
716 | <dt class="tag-source">Source:</dt>
|
717 | <dd class="tag-source"><ul class="dummy"><li>
|
718 | <a href="loki-indexed-adapter.js.html">loki-indexed-adapter.js</a>, <a href="loki-indexed-adapter.js.html#line294">line 294</a>
|
719 | </li></ul></dd>
|
720 |
|
721 |
|
722 |
|
723 |
|
724 |
|
725 |
|
726 |
|
727 | </dl>
|
728 |
|
729 |
|
730 |
|
731 |
|
732 |
|
733 |
|
734 |
|
735 |
|
736 |
|
737 |
|
738 |
|
739 |
|
740 |
|
741 |
|
742 |
|
743 |
|
744 |
|
745 |
|
746 |
|
747 |
|
748 |
|
749 | <h4 class="name" id="getDatabaseList"><span class="type-signature"></span>getDatabaseList<span class="signature">(callback)</span><span class="type-signature"></span></h4>
|
750 |
|
751 |
|
752 |
|
753 |
|
754 |
|
755 | <div class="description">
|
756 | <p>Retrieves object array of catalog entries for current app.</p>
|
757 | </div>
|
758 |
|
759 |
|
760 |
|
761 |
|
762 |
|
763 |
|
764 |
|
765 |
|
766 |
|
767 | <h5>Parameters:</h5>
|
768 |
|
769 |
|
770 | <table class="params">
|
771 | <thead>
|
772 | <tr>
|
773 |
|
774 | <th>Name</th>
|
775 |
|
776 |
|
777 | <th>Type</th>
|
778 |
|
779 |
|
780 |
|
781 |
|
782 |
|
783 | <th class="last">Description</th>
|
784 | </tr>
|
785 | </thead>
|
786 |
|
787 | <tbody>
|
788 |
|
789 |
|
790 | <tr>
|
791 |
|
792 | <td class="name"><code>callback</code></td>
|
793 |
|
794 |
|
795 | <td class="type">
|
796 |
|
797 |
|
798 | <span class="param-type">function</span>
|
799 |
|
800 |
|
801 |
|
802 | </td>
|
803 |
|
804 |
|
805 |
|
806 |
|
807 |
|
808 | <td class="description last"><p>should accept array of database names in the catalog for current app.</p></td>
|
809 | </tr>
|
810 |
|
811 |
|
812 | </tbody>
|
813 | </table>
|
814 |
|
815 |
|
816 |
|
817 |
|
818 |
|
819 |
|
820 | <dl class="details">
|
821 |
|
822 |
|
823 |
|
824 |
|
825 |
|
826 |
|
827 |
|
828 |
|
829 |
|
830 |
|
831 |
|
832 |
|
833 |
|
834 |
|
835 |
|
836 |
|
837 |
|
838 |
|
839 |
|
840 |
|
841 |
|
842 |
|
843 |
|
844 |
|
845 |
|
846 |
|
847 | <dt class="tag-source">Source:</dt>
|
848 | <dd class="tag-source"><ul class="dummy"><li>
|
849 | <a href="loki-indexed-adapter.js.html">loki-indexed-adapter.js</a>, <a href="loki-indexed-adapter.js.html#line249">line 249</a>
|
850 | </li></ul></dd>
|
851 |
|
852 |
|
853 |
|
854 |
|
855 |
|
856 |
|
857 |
|
858 | </dl>
|
859 |
|
860 |
|
861 |
|
862 |
|
863 |
|
864 |
|
865 |
|
866 |
|
867 |
|
868 |
|
869 |
|
870 |
|
871 |
|
872 |
|
873 |
|
874 | <h5>Example</h5>
|
875 |
|
876 | <pre class="prettyprint"><code>idbAdapter.getDatabaseList(function(result) {
// result is array of string names for that appcontext ('finance')
result.forEach(function(str) {
console.log(str);
});
});</code></pre>
|
877 |
|
878 |
|
879 |
|
880 |
|
881 |
|
882 |
|
883 |
|
884 |
|
885 | <h4 class="name" id="loadDatabase"><span class="type-signature"></span>loadDatabase<span class="signature">(dbname, callback)</span><span class="type-signature"></span></h4>
|
886 |
|
887 |
|
888 |
|
889 |
|
890 |
|
891 | <div class="description">
|
892 | <p>Retrieves a serialized db string from the catalog.</p>
|
893 | </div>
|
894 |
|
895 |
|
896 |
|
897 |
|
898 |
|
899 |
|
900 |
|
901 |
|
902 |
|
903 | <h5>Parameters:</h5>
|
904 |
|
905 |
|
906 | <table class="params">
|
907 | <thead>
|
908 | <tr>
|
909 |
|
910 | <th>Name</th>
|
911 |
|
912 |
|
913 | <th>Type</th>
|
914 |
|
915 |
|
916 |
|
917 |
|
918 |
|
919 | <th class="last">Description</th>
|
920 | </tr>
|
921 | </thead>
|
922 |
|
923 | <tbody>
|
924 |
|
925 |
|
926 | <tr>
|
927 |
|
928 | <td class="name"><code>dbname</code></td>
|
929 |
|
930 |
|
931 | <td class="type">
|
932 |
|
933 |
|
934 | <span class="param-type">string</span>
|
935 |
|
936 |
|
937 |
|
938 | </td>
|
939 |
|
940 |
|
941 |
|
942 |
|
943 |
|
944 | <td class="description last"><p>the name of the database to retrieve.</p></td>
|
945 | </tr>
|
946 |
|
947 |
|
948 |
|
949 | <tr>
|
950 |
|
951 | <td class="name"><code>callback</code></td>
|
952 |
|
953 |
|
954 | <td class="type">
|
955 |
|
956 |
|
957 | <span class="param-type">function</span>
|
958 |
|
959 |
|
960 |
|
961 | </td>
|
962 |
|
963 |
|
964 |
|
965 |
|
966 |
|
967 | <td class="description last"><p>callback should accept string param containing serialized db string.</p></td>
|
968 | </tr>
|
969 |
|
970 |
|
971 | </tbody>
|
972 | </table>
|
973 |
|
974 |
|
975 |
|
976 |
|
977 |
|
978 |
|
979 | <dl class="details">
|
980 |
|
981 |
|
982 |
|
983 |
|
984 |
|
985 |
|
986 |
|
987 |
|
988 |
|
989 |
|
990 |
|
991 |
|
992 |
|
993 |
|
994 |
|
995 |
|
996 |
|
997 |
|
998 |
|
999 |
|
1000 |
|
1001 |
|
1002 |
|
1003 |
|
1004 |
|
1005 |
|
1006 | <dt class="tag-source">Source:</dt>
|
1007 | <dd class="tag-source"><ul class="dummy"><li>
|
1008 | <a href="loki-indexed-adapter.js.html">loki-indexed-adapter.js</a>, <a href="loki-indexed-adapter.js.html#line86">line 86</a>
|
1009 | </li></ul></dd>
|
1010 |
|
1011 |
|
1012 |
|
1013 |
|
1014 |
|
1015 |
|
1016 |
|
1017 | </dl>
|
1018 |
|
1019 |
|
1020 |
|
1021 |
|
1022 |
|
1023 |
|
1024 |
|
1025 |
|
1026 |
|
1027 |
|
1028 |
|
1029 |
|
1030 |
|
1031 |
|
1032 |
|
1033 | <h5>Example</h5>
|
1034 |
|
1035 | <pre class="prettyprint"><code>// LOAD
var idbAdapter = new LokiIndexedAdapter('finance');
var db = new loki('test', { adapter: idbAdapter });
db.loadDatabase(function(result) {
console.log('done');
});</code></pre>
|
1036 |
|
1037 |
|
1038 |
|
1039 |
|
1040 |
|
1041 |
|
1042 |
|
1043 |
|
1044 | <h4 class="name" id="saveDatabase"><span class="type-signature"></span>saveDatabase<span class="signature">(dbname, dbstring, callback)</span><span class="type-signature"></span></h4>
|
1045 |
|
1046 |
|
1047 |
|
1048 |
|
1049 |
|
1050 | <div class="description">
|
1051 | <p>Saves a serialized db to the catalog.</p>
|
1052 | </div>
|
1053 |
|
1054 |
|
1055 |
|
1056 |
|
1057 |
|
1058 |
|
1059 |
|
1060 |
|
1061 |
|
1062 | <h5>Parameters:</h5>
|
1063 |
|
1064 |
|
1065 | <table class="params">
|
1066 | <thead>
|
1067 | <tr>
|
1068 |
|
1069 | <th>Name</th>
|
1070 |
|
1071 |
|
1072 | <th>Type</th>
|
1073 |
|
1074 |
|
1075 |
|
1076 |
|
1077 |
|
1078 | <th class="last">Description</th>
|
1079 | </tr>
|
1080 | </thead>
|
1081 |
|
1082 | <tbody>
|
1083 |
|
1084 |
|
1085 | <tr>
|
1086 |
|
1087 | <td class="name"><code>dbname</code></td>
|
1088 |
|
1089 |
|
1090 | <td class="type">
|
1091 |
|
1092 |
|
1093 | <span class="param-type">string</span>
|
1094 |
|
1095 |
|
1096 |
|
1097 | </td>
|
1098 |
|
1099 |
|
1100 |
|
1101 |
|
1102 |
|
1103 | <td class="description last"><p>the name to give the serialized database within the catalog.</p></td>
|
1104 | </tr>
|
1105 |
|
1106 |
|
1107 |
|
1108 | <tr>
|
1109 |
|
1110 | <td class="name"><code>dbstring</code></td>
|
1111 |
|
1112 |
|
1113 | <td class="type">
|
1114 |
|
1115 |
|
1116 | <span class="param-type">string</span>
|
1117 |
|
1118 |
|
1119 |
|
1120 | </td>
|
1121 |
|
1122 |
|
1123 |
|
1124 |
|
1125 |
|
1126 | <td class="description last"><p>the serialized db string to save.</p></td>
|
1127 | </tr>
|
1128 |
|
1129 |
|
1130 |
|
1131 | <tr>
|
1132 |
|
1133 | <td class="name"><code>callback</code></td>
|
1134 |
|
1135 |
|
1136 | <td class="type">
|
1137 |
|
1138 |
|
1139 | <span class="param-type">function</span>
|
1140 |
|
1141 |
|
1142 |
|
1143 | </td>
|
1144 |
|
1145 |
|
1146 |
|
1147 |
|
1148 |
|
1149 | <td class="description last"><p>(Optional) callback passed obj.success with true or false</p></td>
|
1150 | </tr>
|
1151 |
|
1152 |
|
1153 | </tbody>
|
1154 | </table>
|
1155 |
|
1156 |
|
1157 |
|
1158 |
|
1159 |
|
1160 |
|
1161 | <dl class="details">
|
1162 |
|
1163 |
|
1164 |
|
1165 |
|
1166 |
|
1167 |
|
1168 |
|
1169 |
|
1170 |
|
1171 |
|
1172 |
|
1173 |
|
1174 |
|
1175 |
|
1176 |
|
1177 |
|
1178 |
|
1179 |
|
1180 |
|
1181 |
|
1182 |
|
1183 |
|
1184 |
|
1185 |
|
1186 |
|
1187 |
|
1188 | <dt class="tag-source">Source:</dt>
|
1189 | <dd class="tag-source"><ul class="dummy"><li>
|
1190 | <a href="loki-indexed-adapter.js.html">loki-indexed-adapter.js</a>, <a href="loki-indexed-adapter.js.html#line137">line 137</a>
|
1191 | </li></ul></dd>
|
1192 |
|
1193 |
|
1194 |
|
1195 |
|
1196 |
|
1197 |
|
1198 |
|
1199 | </dl>
|
1200 |
|
1201 |
|
1202 |
|
1203 |
|
1204 |
|
1205 |
|
1206 |
|
1207 |
|
1208 |
|
1209 |
|
1210 |
|
1211 |
|
1212 |
|
1213 |
|
1214 |
|
1215 | <h5>Example</h5>
|
1216 |
|
1217 | <pre class="prettyprint"><code>// SAVE : will save App/Key/Val as 'finance'/'test'/{serializedDb}
var idbAdapter = new LokiIndexedAdapter('finance');
var db = new loki('test', { adapter: idbAdapter });
var coll = db.addCollection('testColl');
coll.insert({test: 'val'});
db.saveDatabase(); // could pass callback if needed for async complete</code></pre>
|
1218 |
|
1219 |
|
1220 |
|
1221 |
|
1222 |
|
1223 |
|
1224 |
|
1225 |
|
1226 |
|
1227 | </article>
|
1228 |
|
1229 | </section>
|
1230 |
|
1231 |
|
1232 |
|
1233 |
|
1234 | </div>
|
1235 |
|
1236 | <nav>
|
1237 | <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Collection.html">Collection</a></li><li><a href="DynamicView.html">DynamicView</a></li><li><a href="Loki.html">Loki</a></li><li><a href="LokiEventEmitter.html">LokiEventEmitter</a></li><li><a href="LokiFsAdapter.html">LokiFsAdapter</a></li><li><a href="LokiFsStructuredAdapter.html">LokiFsStructuredAdapter</a></li><li><a href="LokiIndexedAdapter.html">LokiIndexedAdapter</a></li><li><a href="LokiLocalStorageAdapter.html">LokiLocalStorageAdapter</a></li><li><a href="LokiMemoryAdapter.html">LokiMemoryAdapter</a></li><li><a href="LokiPartitioningAdapter.html">LokiPartitioningAdapter</a></li><li><a href="Resultset.html">Resultset</a></li></ul><h3>Tutorials</h3><ul><li><a href="tutorial-Autoupdating Collections.html">Autoupdating Collections</a></li><li><a href="tutorial-Changes API.html">Changes API</a></li><li><a href="tutorial-Collection Transforms.html">Collection Transforms</a></li><li><a href="tutorial-Indexing and Query performance.html">Indexing and Query performance</a></li><li><a href="tutorial-Loki Angular.html">Loki Angular</a></li><li><a href="tutorial-Persistence Adapters.html">Persistence Adapters</a></li><li><a href="tutorial-Query Examples.html">Query Examples</a></li></ul>
|
1238 | </nav>
|
1239 |
|
1240 | <br class="clear">
|
1241 |
|
1242 | <footer>
|
1243 | Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Sun Dec 18 2016 19:39:52 GMT-0500 (Eastern Standard Time)
|
1244 | </footer>
|
1245 |
|
1246 | <script> prettyPrint(); </script>
|
1247 | <script src="scripts/linenumber.js"> </script>
|
1248 | </body>
|
1249 | </html> |
\ | No newline at end of file |