New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.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.7 to 0.1.8

6

CHANGELOG.md

@@ -1,3 +0,7 @@

#0.1.6
#0.1.8
* Return an empty object instead of null for an empty get
#0.1.7
* Fixed bug with count method. Added return type to get and getAll method

@@ -4,0 +8,0 @@

6

dist/on.js

@@ -37,3 +37,3 @@ "use strict";

let result = yield this.db.query(statement);
return result.length > 0 ? result[0] : null;
return result.length > 0 ? result[0] : {};
});

@@ -49,3 +49,3 @@ }

let statement = 'SELECT * FROM ' + this.table;
if (wheres && (wheres.offset || wheres.limit)) {
if (wheres && !options && (wheres.offset || wheres.limit)) {
statement = helpers_1.mapOptionClause(statement, wheres);

@@ -71,3 +71,3 @@ }

statement += ' WHERE id = ?';
let queryData = data.id ? [data, data.id] : data;
const queryData = data.id ? [data, data.id] : data;
return this.db.query(statement, queryData);

@@ -74,0 +74,0 @@ });

import { Model, ModelConstructor } from './model';
import { Query } from './on';
import { Query } from './query';
/** Default MySQL connection option */

@@ -30,3 +30,3 @@ export interface ConnectionOption {

*/
on<T extends Model>(model: ModelConstructor<T>): Query<T>;
query<T extends Model>(model: ModelConstructor<T>): Query<T>;
/**

@@ -37,5 +37,5 @@ * Send prepared sql script to the database

*/
query(query: string, extras?: any): Promise<any>;
prepare(query: string, extras?: any): Promise<any>;
/** Close the connection to the database */
close(): void;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const on_1 = require("./on");
const query_1 = require("./query");
const mysql = require('promise-mysql');

@@ -23,4 +23,4 @@ /**

*/
on(model) {
return new on_1.Query(this, model);
query(model) {
return new query_1.Query(this, model);
}

@@ -32,3 +32,3 @@ /**

*/
query(query, extras) {
prepare(query, extras) {
return extras ? this.conn.query(query, extras) : this.conn.query(query);

@@ -35,0 +35,0 @@ }

export * from './db';
export * from './helpers';
export * from './model';
export * from './on';
export * from './query';

@@ -9,3 +9,3 @@ "use strict";

__export(require("./model"));
__export(require("./on"));
__export(require("./query"));
//# sourceMappingURL=index.js.map
{
"name": "classql",
"version": "0.1.7",
"version": "0.1.8",
"main": "dist/index.js",

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

@@ -22,3 +22,2 @@ const mysql = require('promise-mysql');

constructor(db: Database, model: ModelConstructor<T>) {

@@ -44,3 +43,3 @@ this.db = db;

let result = await this.db.query(statement);
return result.length > 0 ? result[0] : null;
return result.length > 0 ? result[0] : {};
}

@@ -56,3 +55,3 @@

if (wheres && (wheres.offset || wheres.limit)) {
if (wheres && !options && (wheres.offset || wheres.limit)) {
statement = mapOptionClause(statement, wheres);

@@ -75,3 +74,5 @@ } else if (wheres && !wheres.offset && !wheres.limit) {

if (data.id) statement += ' WHERE id = ?';
let queryData = data.id ? [data, data.id] : data;
const queryData = data.id ? [data, data.id] : data;
return this.db.query(statement, queryData);

@@ -78,0 +79,0 @@ }

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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