@imatic/pgqb
Advanced tools
Comparing version 0.1.8 to 0.1.9
@@ -38,2 +38,4 @@ import * as qb from './qb'; | ||
export declare function orderBy(expr: qb.Expr, direction?: 'ASC' | 'DESC', nullsFirst?: boolean): qb.Sql; | ||
export declare function limit(n: any): qb.Sql; | ||
export declare function offset(n: any): qb.Sql; | ||
export declare function forUpdate(): qb.Sql; | ||
@@ -40,0 +42,0 @@ export declare function returning(exprs: qb.Expr[]): qb.Sql; |
@@ -125,2 +125,10 @@ "use strict"; | ||
exports.orderBy = orderBy; | ||
function limit(n) { | ||
return { limit: n }; | ||
} | ||
exports.limit = limit; | ||
function offset(n) { | ||
return { offset: n }; | ||
} | ||
exports.offset = offset; | ||
function forUpdate() { | ||
@@ -127,0 +135,0 @@ return { for_update: true }; |
@@ -31,2 +31,4 @@ export interface InlineParam { | ||
order_by?: OrderBy; | ||
limit?: number; | ||
offset?: number; | ||
for_update?: true; | ||
@@ -33,0 +35,0 @@ returning?: Expr[]; |
@@ -273,2 +273,4 @@ "use strict"; | ||
.append(order[2]), orderBy))), | ||
limit: (l) => `LIMIT ${l}`, | ||
offset: (o) => `OFFSET ${o}`, | ||
for_update: () => 'FOR UPDATE', | ||
@@ -275,0 +277,0 @@ returning: exprsHandler('RETURNING '), |
{ | ||
"name": "@imatic/pgqb", | ||
"version": "0.1.8", | ||
"version": "0.1.9", | ||
"description": "Functional PostgreSQL query builder", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.js", |
@@ -152,2 +152,10 @@ import * as qb from './qb'; | ||
export function limit(n): qb.Sql { | ||
return {limit: n}; | ||
} | ||
export function offset(n): qb.Sql { | ||
return {offset: n}; | ||
} | ||
export function forUpdate(): qb.Sql { | ||
@@ -154,0 +162,0 @@ return {for_update: true}; |
@@ -58,2 +58,4 @@ import * as r from 'ramda'; | ||
order_by?: OrderBy; | ||
limit?: number; | ||
offset?: number; | ||
for_update?: true; | ||
@@ -456,2 +458,4 @@ returning?: Expr[]; | ||
), | ||
limit: (l: number) => `LIMIT ${l}`, | ||
offset: (o: number) => `OFFSET ${o}`, | ||
for_update: () => 'FOR UPDATE', | ||
@@ -458,0 +462,0 @@ returning: exprsHandler('RETURNING '), |
@@ -109,3 +109,5 @@ import {expect} from 'chai'; | ||
), | ||
h.orderBy('at.id') | ||
h.orderBy('at.id'), | ||
h.limit(5), | ||
h.offset(3) | ||
), | ||
@@ -129,2 +131,4 @@ expected: { | ||
order_by: [['at.id', 'ASC', 'NULLS LAST']], | ||
limit: 5, | ||
offset: 3, | ||
}, | ||
@@ -131,0 +135,0 @@ }, |
@@ -101,2 +101,4 @@ import {expect} from 'chai'; | ||
order_by: [['at.id', 'ASC', 'NULLS LAST']], | ||
limit: 5, | ||
offset: 3, | ||
}, | ||
@@ -110,3 +112,5 @@ sql: { | ||
' WHERE ("t"."col1" = 3 AND ("t"."col2" = $1 OR "t"."col3" = $2))' + | ||
' ORDER BY "at"."id" ASC NULLS LAST', | ||
' ORDER BY "at"."id" ASC NULLS LAST' + | ||
' LIMIT 5' + | ||
' OFFSET 3', | ||
values: [5, 6], | ||
@@ -113,0 +117,0 @@ }, |
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
93941
1801