Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

classql

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

classql - npm Package Compare versions

Comparing version 0.1.5 to 0.1.6

4

CHANGELOG.md

@@ -0,1 +1,5 @@

#0.1.6
* Added count method
#0.1.5

@@ -2,0 +6,0 @@

@@ -46,2 +46,8 @@ import 'reflect-metadata';

delete(wheres: any): Promise<any>;
/**
* Count items by where clause
* @param wheres
* @return promised returned query
*/
count(wheres: any): Promise<any>;
}

@@ -112,4 +112,19 @@ "use strict";

}
/**
* Count items by where clause
* @param wheres
* @return promised returned query
*/
count(wheres) {
return __awaiter(this, void 0, void 0, function* () {
if (!wheres)
throw new Error(exports.errors.where);
let statement = 'SELECT COUNT(*) AS count FROM ' + this.table;
statement = helpers_1.mapWhereClause(statement, wheres);
const data = yield this.db.query(statement);
return data.count;
});
}
}
exports.Query = Query;
//# sourceMappingURL=on.js.map

2

package.json
{
"name": "classql",
"version": "0.1.5",
"version": "0.1.6",
"main": "dist/index.js",

@@ -5,0 +5,0 @@ "bugs": "https://github.com/sorakthunly/classql/issues",

@@ -98,2 +98,7 @@ # classql

/** COUNT */
// Returns the number of result counted e.g. 12
await db.on(UserAccount).count({ name: 'John' });
```

@@ -115,2 +115,16 @@ const mysql = require('promise-mysql');

}
/**
* Count items by where clause
* @param wheres
* @return promised returned query
*/
public async count(wheres: any): Promise<any> {
if (!wheres) throw new Error(errors.where);
let statement = 'SELECT COUNT(*) AS count FROM ' + this.table;
statement = mapWhereClause(statement, wheres);
const data = await this.db.query(statement);
return data.count;
}
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc