@imatic/pgqb
Advanced tools
Comparing version 0.1.13 to 0.1.14
@@ -59,2 +59,3 @@ import * as qb from './qb'; | ||
null: (expr: qb.Expr) => qb.Expr; | ||
notNull: (expr: qb.Expr) => qb.Expr; | ||
caseWhen: (...args: qb.Expr[]) => qb.Expr; | ||
@@ -61,0 +62,0 @@ in: (expr: qb.Expr, values: qb.Sql | qb.Value[]) => qb.Expr; |
@@ -169,2 +169,3 @@ "use strict"; | ||
null: (expr) => ['null', expr], | ||
notNull: (expr) => ['not_null', expr], | ||
caseWhen: (...args) => ['case_when', ...args], | ||
@@ -171,0 +172,0 @@ in: (expr, values) => ['in', expr, ...(Array.isArray(values) ? values : [values])], |
@@ -10,3 +10,3 @@ export interface InlineParam { | ||
export declare type ExprOperand = Sql | Value; | ||
export declare type UnaryOperator = 'null'; | ||
export declare type UnaryOperator = 'null' | 'not_null'; | ||
export declare type BinaryOperator = '=' | '!=' | '>' | '>=' | '<' | '<=' | 'as' | 'like'; | ||
@@ -13,0 +13,0 @@ export declare type VarOperator = 'and' | 'or' | 'case_when' | 'in'; |
@@ -220,2 +220,3 @@ "use strict"; | ||
null: (expr) => handleExpr(expr).append(' IS NULL'), | ||
not_null: (expr) => handleExpr(expr).append(' IS NOT NULL'), | ||
case_when: (...args) => appendToStatement(sql_template_strings_1.SQL `CASE `, r.intersperse(' ', r.map(statements => handleCaseExprTuple(statements), r.splitEvery(2, r.map(handleExpr, args))))).append(' END'), | ||
@@ -222,0 +223,0 @@ in: inHandler, |
{ | ||
"name": "@imatic/pgqb", | ||
"version": "0.1.13", | ||
"version": "0.1.14", | ||
"description": "Functional PostgreSQL query builder", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.js", |
@@ -198,2 +198,3 @@ import * as qb from './qb'; | ||
null: (expr: qb.Expr): qb.Expr => ['null', expr], | ||
notNull: (expr: qb.Expr): qb.Expr => ['not_null', expr], | ||
caseWhen: (...args: qb.Expr[]): qb.Expr => | ||
@@ -200,0 +201,0 @@ ['case_when', ...args] as qb.Expr, |
@@ -18,3 +18,3 @@ import * as r from 'ramda'; | ||
export type UnaryOperator = 'null'; | ||
export type UnaryOperator = 'null' | 'not_null'; | ||
@@ -360,2 +360,3 @@ export type BinaryOperator = | ||
null: (expr: Expr) => handleExpr(expr).append(' IS NULL'), | ||
not_null: (expr: Expr) => handleExpr(expr).append(' IS NOT NULL'), | ||
case_when: (...args: Expr[]) => | ||
@@ -362,0 +363,0 @@ appendToStatement( |
@@ -141,2 +141,3 @@ import {expect} from 'chai'; | ||
h.expr.null('t.id'), | ||
h.expr.notNull('t.id'), | ||
h.expr.eq('t.code', h.val.inlineParam(null)), | ||
@@ -169,2 +170,3 @@ h.expr.eq('t.code', h.val.raw(null)), | ||
['null', 't.id'], | ||
['not_null', 't.id'], | ||
['=', 't.code', {ip: null}], | ||
@@ -171,0 +173,0 @@ ['=', 't.code', {r: null}], |
@@ -138,2 +138,3 @@ import {expect} from 'chai'; | ||
['null', 't.id'], | ||
['not_null', 't.id'], | ||
['=', 't.code', {ip: null}], | ||
@@ -165,2 +166,3 @@ ['=', 't.code', {r: null}], | ||
' "t"."id" IS NULL,' + | ||
' "t"."id" IS NOT NULL,' + | ||
' "t"."code" = $1,' + | ||
@@ -167,0 +169,0 @@ ' "t"."code" = null,' + |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
97326
1875
22