@imatic/pgqb
Advanced tools
Comparing version
@@ -37,2 +37,3 @@ import * as qb from './qb'; | ||
export declare function doUpdate(exprs: qb.Expr[]): qb.Sql; | ||
export declare function doNothing(): qb.Sql; | ||
export declare function where(expr: qb.Expr): qb.Sql; | ||
@@ -39,0 +40,0 @@ export declare function groupBy(exprs: qb.Expr[]): qb.Sql; |
@@ -116,2 +116,6 @@ "use strict"; | ||
exports.doUpdate = doUpdate; | ||
function doNothing() { | ||
return { do_nothing: null }; | ||
} | ||
exports.doNothing = doNothing; | ||
function where(expr) { | ||
@@ -118,0 +122,0 @@ return { where: expr }; |
@@ -35,2 +35,3 @@ export interface InlineParam { | ||
do_update?: Expr[]; | ||
do_nothing?: null; | ||
where?: Expr; | ||
@@ -37,0 +38,0 @@ group_by?: Expr[]; |
@@ -19,2 +19,3 @@ "use strict"; | ||
'do_update', | ||
'do_nothing', | ||
'where', | ||
@@ -265,2 +266,3 @@ 'group_by', | ||
do_update: exprsHandler('DO UPDATE SET '), | ||
do_nothing: () => 'DO NOTHING', | ||
set: exprsHandler('SET '), | ||
@@ -267,0 +269,0 @@ from: tableExprHandler('FROM '), |
{ | ||
"name": "@imatic/pgqb", | ||
"version": "0.1.17", | ||
"version": "0.1.18", | ||
"description": "Functional PostgreSQL query builder", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.js", |
@@ -145,2 +145,6 @@ import * as qb from './qb'; | ||
export function doNothing(): qb.Sql { | ||
return {do_nothing: null}; | ||
} | ||
export function where(expr: qb.Expr): qb.Sql { | ||
@@ -147,0 +151,0 @@ return {where: expr}; |
@@ -72,2 +72,3 @@ import * as r from 'ramda'; | ||
do_update?: Expr[]; | ||
do_nothing?: null; | ||
where?: Expr; | ||
@@ -103,2 +104,3 @@ group_by?: Expr[]; | ||
'do_update', | ||
'do_nothing', | ||
'where', | ||
@@ -442,2 +444,3 @@ 'group_by', | ||
do_update: exprsHandler('DO UPDATE SET '), | ||
do_nothing: () => 'DO NOTHING', | ||
set: exprsHandler('SET '), | ||
@@ -444,0 +447,0 @@ from: tableExprHandler('FROM '), |
@@ -28,2 +28,3 @@ import {expect} from 'chai'; | ||
h.doUpdate([h.expr.eq('val3', 'excluded.val3')]), | ||
h.doNothing(), | ||
h.where(h.expr.neq('excluded.third', h.val.inlineParam(5))) | ||
@@ -50,2 +51,3 @@ ), | ||
do_update: [['=', 'val3', 'excluded.val3']], | ||
do_nothing: null, | ||
where: ['!=', 'excluded.third', {ip: 5}], | ||
@@ -52,0 +54,0 @@ }, |
@@ -29,2 +29,3 @@ import {expect} from 'chai'; | ||
do_update: [['=', 'val3', 'excluded.val3']], | ||
do_nothing: null, | ||
where: ['!=', 'excluded.third', {ip: 5}], | ||
@@ -41,2 +42,3 @@ }, | ||
' SET "val3" = "excluded"."val3"' + | ||
' DO NOTHING' + | ||
' WHERE "excluded"."third" != $7', | ||
@@ -43,0 +45,0 @@ values: [ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
86168
0.74%1991
0.91%