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

ee-query-builder

Package Overview
Dependencies
Maintainers
1
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ee-query-builder - npm Package Compare versions

Comparing version 0.1.26 to 0.1.27

131

lib/Functions.js
!function(){
var Class = require('ee-class')
, log = require('ee-log')
, type = require('ee-types');
var Class = require('ee-class')
, log = require('ee-log')
, type = require('ee-types');
module.exports = new Class({
aggregateFunctions: {
avg : 'AVG'
, sum : 'SUM'
, min : 'MIN'
, max : 'MAX'
, count : 'COUNT'
}
module.exports = new Class({
aggregateFunctions: {
avg : 'AVG'
, sum : 'SUM'
, min : 'MIN'
, max : 'MAX'
, count : 'COUNT'
}
, init: function(options){
this._escapeId = options.escapeId;
this._escape = options.escape;
this._queryBuilder = options.queryBuilder;
}
, init: function(options){
this._escapeId = options.escapeId;
this._escape = options.escape;
this._type = options.type;
this._queryBuilder = options.queryBuilder;
}
, renderSelectFunction: function(tablename, command) {
return this.aggregateFunctions[command.fn]+'('+this._escapeId(tablename)+'.'+this._escapeId(command.value)+')'+(command.alias ? ' AS '+this._escapeId(command.alias) : '');
}
, renderSelectFunction: function(tablename, command) {
return this.aggregateFunctions[command.fn]+'('+this._escapeId(tablename)+'.'+this._escapeId(command.value)+')'+(command.alias ? ' AS '+this._escapeId(command.alias) : '');
}
, in: function(command, paramaters) {
var values = command.values;
, in: function(command, paramaters) {
var values = command.values;
if (type.array(command.values) && command.values.length && type.function(command.values[0].isQuery)) values = values[0];
if (type.array(command.values) && command.values.length && type.function(command.values[0].isQuery)) values = values[0];
//if (command.values.length) {
if (type.function(values.isQuery)) {
return ' IN ('+this._queryBuilder._render('query', this._queryBuilder._prepareQueryFilter(values), paramaters).SQLString+')';
}
else {
return ' IN (' +values.map(function(value) {
return this._escape(value);
}.bind(this)).join(', ') +')';
}
//}
}
//if (command.values.length) {
if (type.function(values.isQuery)) {
return ' IN ('+this._queryBuilder._render('query', this._queryBuilder._prepareQueryFilter(values), paramaters).SQLString+')';
}
else {
return ' IN (' +values.map(function(value) {
return this._escape(value);
}.bind(this)).join(', ') +')';
}
//}
}
, notIn: function(command, paramaters) {
var values = command.values;
if (type.array(command.values) && command.values.length && type.function(command.values[0].isQuery)) values = values[0];
if (type.function(values.isQuery)) {
return ' NOT IN ('+this._queryBuilder._render('query', this._queryBuilder._prepareQueryFilter(values), paramaters).SQLString+')';
}
else {
return ' NOT IN (' +values.map(function(value){
return this._escape(value);
}.bind(this)).join(', ') +')';
}
}
, notIn: function(command, paramaters) {
var values = command.values;
if (type.array(command.values) && command.values.length && type.function(command.values[0].isQuery)) values = values[0];
if (type.function(values.isQuery)) {
return ' NOT IN ('+this._queryBuilder._render('query', this._queryBuilder._prepareQueryFilter(values), paramaters).SQLString+')';
}
else {
return ' NOT IN (' +values.map(function(value){
return this._escape(value);
}.bind(this)).join(', ') +')';
}
}
, like: function(command) {
return ' LIKE '+this._escape(command.value);
}
, like: function(command) {
return ' '+(this._type === 'postgres' ? 'I' : '')+'LIKE '+this._escape(command.value);
}
, notLike: function(command) {
return ' NOT LIKE '+this._escape(command.value);
}
, notLike: function(command) {
return ' NOT '+(this._type === 'postgres' ? 'I' : '')+'LIKE '+this._escape(command.value);
}
, 'null': function(){
return ' is null';
}
, 'null': function(){
return ' is null';
}
, 'notNull': function(){
return ' is not null';
}
});
, 'notNull': function(){
return ' is not null';
}
});
}();
{
"name" : "ee-query-builder"
, "description" : "query builder for ee-orm"
, "version" : "0.1.26"
, "version" : "0.1.27"
, "homepage" : "https://github.com/eventEmitter/ee-query-builder"

@@ -6,0 +6,0 @@ , "author" : "Michael van der Weg <michael@eventemitter.com> (http://eventemitter.com/)"

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