99[ ![ Downloads] [ downloads-image ]] [ downloads-url ]
1010
1111
12- ##Get Started
12+ ## Get Started
1313``` bash
1414bower install angular-sql-query --save
1515```
@@ -31,14 +31,14 @@ When you're done, your setup should look similar to the following:
3131 <script src =" bower_components/angular-sql-query/angular-sql-query.min.js" ></script >
3232 ...
3333 <script >
34- var myApp = angular .module (' myApp' , [' sf.sqlQuery' ]);
35-
34+ var myApp = angular .module (' myApp' , [' sf.sqlQuery' ]);
3635 </script >
3736 ...
3837</body >
3938</html >
4039```
41- ##Configuration
40+
41+ ## Configuration
4242For using this module, your database need to be architectured with these fields:
4343- ` id ` : Unique key for data.
4444- ` payload ` : Object data stringify with angular.toJson.
@@ -56,6 +56,7 @@ var user = new SqlQueryService(name, databaseFn, options);
5656- ` database ` [ Function] - Function that return SQL database instance.
5757- ` options ` [ Function] - Query options
5858 - ` indexed_fields ` [ Array] - Reference field by adding a column in the table.
59+
5960``` js
6061function databaseInstance () {
6162 return $q .when ($window .openDatabase (' test' , ' 1' , ' database' , 200000 ));
@@ -65,8 +66,9 @@ var user = new SqlQueryService('user', databaseInstance, {
6566});
6667```
6768
68- ##API Documentation
69- ##getBackUp
69+ ## API Documentation
70+
71+ ### .getBackUp()
7072Get data by its id
7173
7274** Params**
@@ -78,7 +80,7 @@ Get data by its id
7880user .getBackUp (1 );
7981```
8082
81- ##listBackUp
83+ ### . listBackUp()
8284All datas
8385
8486** Returns:** [ Array] ` payload `
@@ -87,10 +89,13 @@ All datas
8789user .listBackUp ();
8890```
8991
90- ##queryBackUp
91- All datas corresponding to query.<br />
92- If field is referenced in options, query can be set directly in SQl Query. Also, a javascript filter is used.<br />
93- You need to pass an object; the key is the field name and the value is the query value.<br />
92+ ### .queryBackUp()
93+ All datas corresponding to query.
94+
95+ If field is referenced in options, query can be set directly in SQl Query. Also, a javascript filter is used.
96+
97+ You need to pass an object; the key is the field name and the value is the query value.
98+
9499You can pass an ** Array** to make a ` IN ` query or a ** Boolean** for a 1 or 0 query.
95100
96101** Params:**
@@ -105,7 +110,7 @@ user.queryBackUp({
105110});
106111```
107112
108- ##saveBackUp
113+ ### . saveBackUp()
109114Save new object data
110115
111116** Params:**
@@ -118,7 +123,7 @@ Save new object data
118123user .saveBackUp (1 , { name: ' Jean' , connected: false });
119124```
120125
121- ##updateBackUp
126+ ### . updateBackUp()
122127Update database object
123128
124129** Params:**
@@ -130,7 +135,7 @@ Update database object
130135user .updateBackUp ({ id: 1 , name: ' Paul' , connected: false });
131136```
132137
133- ##removeBackUp
138+ ### . removeBackUp()
134139Remove database object
135140
136141** Params:**
@@ -142,9 +147,11 @@ Remove database object
142147user .removeBackUp (1 );
143148```
144149
145- ##bulkDocsBackUp
146- Modify multiple datas<br />
147- It's possible to update or remove datas with one method called.<br />
150+ ### .bulkDocsBackUp()
151+ Modify multiple datas
152+
153+ It's possible to update or remove datas with one method called.
154+
148155You can delete a data by setting an the object key ` _delete ` to true.
149156
150157** Params:**
@@ -159,7 +166,7 @@ user.bulkDocsBackUp([{
159166}]);
160167```
161168
162- ##execute
169+ ### . execute()
163170Directly make an SQL query.
164171
165172** Params:**
0 commit comments