Comparing version 0.6.1 to 0.6.2
@@ -34,3 +34,3 @@ import * as pr from './predicates'; | ||
* @param field The field name | ||
* @param check The conditional check | ||
* @param arg The user provided arg | ||
*/ | ||
@@ -42,2 +42,3 @@ whereIsEqual(field: string, arg: unknown): T; | ||
* @param field The field name | ||
* @param arg The user provided arg | ||
* @param check The conditional check | ||
@@ -50,3 +51,3 @@ */ | ||
* @param field The field name | ||
* @param check The conditional check | ||
* @param arg The user provided arg | ||
*/ | ||
@@ -58,2 +59,3 @@ whereIsNotEquals(field: string, arg: unknown): T; | ||
* @param field The field name | ||
* @param arg The user provided arg | ||
* @param check The conditional check | ||
@@ -63,2 +65,62 @@ */ | ||
/** | ||
* Adds a less than check the given field and arg. | ||
* | ||
* @param field The field name | ||
* @param arg The user provided arg | ||
*/ | ||
whereIsLessThan(field: string, arg: unknown): T; | ||
/** | ||
* Adds a less than or equal to check the given field and arg. | ||
* | ||
* @param field The field name | ||
* @param arg The user provided arg | ||
*/ | ||
whereIsLessThanOrEqualTo(field: string, arg: unknown): T; | ||
/** | ||
* Adds a greater than check the given field and arg. | ||
* | ||
* @param field The field name | ||
* @param arg The user provided arg | ||
*/ | ||
whereIsGreaterThan(field: string, arg: unknown): T; | ||
/** | ||
* Adds a greater than check the given field and arg. | ||
* | ||
* @param field The field name | ||
* @param arg The user provided arg | ||
*/ | ||
whereIsGreaterThanOrEqualTo(field: string, arg: unknown): T; | ||
/** | ||
* Adds a less than check the given field and arg. | ||
* | ||
* @param field The field name | ||
* @param arg The user provided arg | ||
* @param check The conditional check | ||
*/ | ||
whereIsLessThanIf(field: string, arg: unknown, check: boolean): T; | ||
/** | ||
* Adds a less than or equal to check the given field and arg. | ||
* | ||
* @param field The field name | ||
* @param arg The user provided arg | ||
* @param check The conditional check | ||
*/ | ||
whereIsLessThanOrEqualToIf(field: string, arg: unknown, check: boolean): T; | ||
/** | ||
* Adds a greater than check the given field and arg. | ||
* | ||
* @param field The field name | ||
* @param arg The user provided arg | ||
* @param check The conditional check | ||
*/ | ||
whereIsGreaterThanIf(field: string, arg: unknown, check: boolean): T; | ||
/** | ||
* Adds a greater than check the given field and arg. | ||
* | ||
* @param field The field name | ||
* @param arg The user provided arg | ||
* @param check The conditional check | ||
*/ | ||
whereIsGreaterThanOrEqualToIf(field: string, arg: unknown, check: boolean): T; | ||
/** | ||
* Adds a null check for the given field. | ||
@@ -65,0 +127,0 @@ * |
@@ -32,3 +32,3 @@ "use strict"; | ||
* @param field The field name | ||
* @param check The conditional check | ||
* @param arg The user provided arg | ||
*/ | ||
@@ -43,2 +43,3 @@ whereIsEqual(field, arg) { | ||
* @param field The field name | ||
* @param arg The user provided arg | ||
* @param check The conditional check | ||
@@ -56,3 +57,3 @@ */ | ||
* @param field The field name | ||
* @param check The conditional check | ||
* @param arg The user provided arg | ||
*/ | ||
@@ -67,2 +68,3 @@ whereIsNotEquals(field, arg) { | ||
* @param field The field name | ||
* @param arg The user provided arg | ||
* @param check The conditional check | ||
@@ -77,2 +79,94 @@ */ | ||
/** | ||
* Adds a less than check the given field and arg. | ||
* | ||
* @param field The field name | ||
* @param arg The user provided arg | ||
*/ | ||
whereIsLessThan(field, arg) { | ||
this.predicates.push(pr.isLessThan(field, arg)); | ||
return this.getThis(); | ||
} | ||
/** | ||
* Adds a less than or equal to check the given field and arg. | ||
* | ||
* @param field The field name | ||
* @param arg The user provided arg | ||
*/ | ||
whereIsLessThanOrEqualTo(field, arg) { | ||
this.predicates.push(pr.isLessThanOrEqualTo(field, arg)); | ||
return this.getThis(); | ||
} | ||
/** | ||
* Adds a greater than check the given field and arg. | ||
* | ||
* @param field The field name | ||
* @param arg The user provided arg | ||
*/ | ||
whereIsGreaterThan(field, arg) { | ||
this.predicates.push(pr.isGreaterThan(field, arg)); | ||
return this.getThis(); | ||
} | ||
/** | ||
* Adds a greater than check the given field and arg. | ||
* | ||
* @param field The field name | ||
* @param arg The user provided arg | ||
*/ | ||
whereIsGreaterThanOrEqualTo(field, arg) { | ||
this.predicates.push(pr.isGreaterThanOrEqualTo(field, arg)); | ||
return this.getThis(); | ||
} | ||
/** | ||
* Adds a less than check the given field and arg. | ||
* | ||
* @param field The field name | ||
* @param arg The user provided arg | ||
* @param check The conditional check | ||
*/ | ||
whereIsLessThanIf(field, arg, check) { | ||
if (check) { | ||
this.predicates.push(pr.isLessThan(field, arg)); | ||
} | ||
return this.getThis(); | ||
} | ||
/** | ||
* Adds a less than or equal to check the given field and arg. | ||
* | ||
* @param field The field name | ||
* @param arg The user provided arg | ||
* @param check The conditional check | ||
*/ | ||
whereIsLessThanOrEqualToIf(field, arg, check) { | ||
if (check) { | ||
this.predicates.push(pr.isLessThanOrEqualTo(field, arg)); | ||
} | ||
return this.getThis(); | ||
} | ||
/** | ||
* Adds a greater than check the given field and arg. | ||
* | ||
* @param field The field name | ||
* @param arg The user provided arg | ||
* @param check The conditional check | ||
*/ | ||
whereIsGreaterThanIf(field, arg, check) { | ||
if (check) { | ||
this.predicates.push(pr.isGreaterThan(field, arg)); | ||
} | ||
return this.getThis(); | ||
} | ||
/** | ||
* Adds a greater than check the given field and arg. | ||
* | ||
* @param field The field name | ||
* @param arg The user provided arg | ||
* @param check The conditional check | ||
*/ | ||
whereIsGreaterThanOrEqualToIf(field, arg, check) { | ||
if (check) { | ||
this.predicates.push(pr.isGreaterThanOrEqualTo(field, arg)); | ||
} | ||
return this.getThis(); | ||
} | ||
/** | ||
* Adds a null check for the given field. | ||
@@ -79,0 +173,0 @@ * |
@@ -28,2 +28,30 @@ /** | ||
/** | ||
* `<field> < <arg>` check between a field and the given arg. | ||
* | ||
* @param field The field name | ||
* @param arg The user given arg | ||
*/ | ||
export declare function isLessThan(field: string, arg: unknown): Predicate; | ||
/** | ||
* `<field> <= <arg>` check between a field and the given arg. | ||
* | ||
* @param field The field name | ||
* @param arg The user given arg | ||
*/ | ||
export declare function isLessThanOrEqualTo(field: string, arg: unknown): Predicate; | ||
/** | ||
* `<field> >= <arg>` check between a field and the given arg. | ||
* | ||
* @param field The field name | ||
* @param arg The user given arg | ||
*/ | ||
export declare function isGreaterThanOrEqualTo(field: string, arg: unknown): Predicate; | ||
/** | ||
* `<field> > <arg>` check between a field and the given arg. | ||
* | ||
* @param field The field name | ||
* @param arg The user given arg | ||
*/ | ||
export declare function isGreaterThan(field: string, arg: unknown): Predicate; | ||
/** | ||
* `<field> IS NULL` check between a field and the given arg. | ||
@@ -30,0 +58,0 @@ * |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.isIn = exports.isLike = exports.isNotNull = exports.isNull = exports.isNotEqual = exports.isEqual = exports.Predicate = void 0; | ||
exports.isIn = exports.isLike = exports.isNotNull = exports.isNull = exports.isGreaterThan = exports.isGreaterThanOrEqualTo = exports.isLessThanOrEqualTo = exports.isLessThan = exports.isNotEqual = exports.isEqual = exports.Predicate = void 0; | ||
/** | ||
@@ -41,2 +41,42 @@ * Defines a sql predicate statement used to narrow queries. | ||
/** | ||
* `<field> < <arg>` check between a field and the given arg. | ||
* | ||
* @param field The field name | ||
* @param arg The user given arg | ||
*/ | ||
function isLessThan(field, arg) { | ||
return new Predicate(`${field} < ?`, arg); | ||
} | ||
exports.isLessThan = isLessThan; | ||
/** | ||
* `<field> <= <arg>` check between a field and the given arg. | ||
* | ||
* @param field The field name | ||
* @param arg The user given arg | ||
*/ | ||
function isLessThanOrEqualTo(field, arg) { | ||
return new Predicate(`${field} <= ?`, arg); | ||
} | ||
exports.isLessThanOrEqualTo = isLessThanOrEqualTo; | ||
/** | ||
* `<field> >= <arg>` check between a field and the given arg. | ||
* | ||
* @param field The field name | ||
* @param arg The user given arg | ||
*/ | ||
function isGreaterThanOrEqualTo(field, arg) { | ||
return new Predicate(`${field} >= ?`, arg); | ||
} | ||
exports.isGreaterThanOrEqualTo = isGreaterThanOrEqualTo; | ||
/** | ||
* `<field> > <arg>` check between a field and the given arg. | ||
* | ||
* @param field The field name | ||
* @param arg The user given arg | ||
*/ | ||
function isGreaterThan(field, arg) { | ||
return new Predicate(`${field} > ?`, arg); | ||
} | ||
exports.isGreaterThan = isGreaterThan; | ||
/** | ||
* `<field> IS NULL` check between a field and the given arg. | ||
@@ -43,0 +83,0 @@ * |
@@ -29,2 +29,10 @@ import { PredicateBaseBuilder } from './basebuilders'; | ||
/** | ||
* Specifies the column to sort the queried row by | ||
* | ||
* @param col The column to order by | ||
* @param isDescending Whether to sort in descending order | ||
* @param check The conditional check | ||
*/ | ||
orderByIf(col: string, isDescending: boolean | undefined, check: boolean): Select; | ||
/** | ||
* Sets a limit on the select query | ||
@@ -31,0 +39,0 @@ * |
@@ -42,2 +42,15 @@ "use strict"; | ||
/** | ||
* Specifies the column to sort the queried row by | ||
* | ||
* @param col The column to order by | ||
* @param isDescending Whether to sort in descending order | ||
* @param check The conditional check | ||
*/ | ||
orderByIf(col, isDescending = false, check) { | ||
if (check) { | ||
this.orderBy(col, isDescending); | ||
} | ||
return this; | ||
} | ||
/** | ||
* Sets a limit on the select query | ||
@@ -44,0 +57,0 @@ * |
{ | ||
"name": "sqrolls", | ||
"version": "0.6.1", | ||
"version": "0.6.2", | ||
"description": "sql builder library", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
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
32270
971