Comparing version 0.1.1 to 0.1.2
@@ -0,3 +1,7 @@ | ||
#0.1.2 | ||
* Updated README.md. Add saveAll use case. | ||
#0.1.1 | ||
* Updated README.md |
{ | ||
"name": "classql", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"main": "dist/index.js", | ||
@@ -5,0 +5,0 @@ "bugs": "https://github.com/sorakthunly/classql/issues", |
@@ -60,3 +60,3 @@ # classql | ||
// Returns a list of objects or an empty list: | ||
await db.on(UserAccount)>getAll(); | ||
await db.on(UserAccount).getAll(); | ||
await db.on(UserAccount).getAll({ firstName: 'John' }); | ||
@@ -83,3 +83,2 @@ | ||
}); | ||
let result = await db.on(UserAccount).save(account); | ||
@@ -89,2 +88,11 @@ let id = result.insertId; | ||
/** CREATE ALL OR UPDATE ALL */ | ||
// If no id field exists on every object in a list, this method runs INSERT query. | ||
// Otherwise, it will run INSERT and ON DUPLICATE UPDATE. | ||
let items = [ | ||
new UserAccount({ ... }), new UserAccount({ ... }), new UserAccount({ ... }) | ||
]; | ||
await db.on(UserAccount).saveAll(items); | ||
// Alternatively, to enter prepared sql statement just do: | ||
@@ -91,0 +99,0 @@ db.query('SELECT * FROM USER_ACCOUNTS WHERE id > 5').then(doSth).catch(doSthElse); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
44815
99