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

@imatic/pgqb

Package Overview
Dependencies
Maintainers
2
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@imatic/pgqb - npm Package Compare versions

Comparing version 0.1.11 to 0.1.12

1

dist/helper.d.ts

@@ -37,2 +37,3 @@ import * as qb from './qb';

export declare function where(expr: qb.Expr): qb.Sql;
export declare function groupBy(exprs: qb.Expr[]): qb.Sql;
export declare function orderBy(expr: qb.Expr, direction?: 'ASC' | 'DESC', nullsFirst?: boolean): qb.Sql;

@@ -39,0 +40,0 @@ export declare function limit(n: any): qb.Sql;

@@ -113,2 +113,6 @@ "use strict";

exports.where = where;
function groupBy(exprs) {
return { group_by: exprs };
}
exports.groupBy = groupBy;
function orderBy(expr, direction, nullsFirst) {

@@ -115,0 +119,0 @@ const directionString = direction || 'ASC';

@@ -30,2 +30,3 @@ export interface InlineParam {

where?: Expr;
group_by?: Expr[];
order_by?: OrderBy;

@@ -32,0 +33,0 @@ limit?: number;

@@ -20,2 +20,3 @@ "use strict";

'where',
'group_by',
'order_by',

@@ -272,2 +273,3 @@ 'limit',

where: (expr) => sql_template_strings_1.SQL `WHERE `.append(handleExpr(expr)),
group_by: (exprs) => appendToStatement(sql_template_strings_1.SQL `GROUP BY `, r.intersperse(', ', r.map(handleExpr, exprs))),
order_by: (orderBy) => appendToStatement(sql_template_strings_1.SQL `ORDER BY `, r.intersperse(', ', r.map(order => handleExpr(order[0])

@@ -274,0 +276,0 @@ .append(' ')

2

package.json
{
"name": "@imatic/pgqb",
"version": "0.1.11",
"version": "0.1.12",
"description": "Functional PostgreSQL query builder",

@@ -5,0 +5,0 @@ "main": "./dist/index.js",

@@ -80,3 +80,3 @@ import * as qb from './qb';

export function append(...m: qb.Sql[]): qb.Sql {
return r.reduce(_append, r.head(m), r.tail(m));
return r.reduce(_append, r.head(m) as qb.Sql, r.tail(m) as qb.Sql[]);
}

@@ -136,2 +136,6 @@

export function groupBy(exprs: qb.Expr[]): qb.Sql {
return {group_by: exprs};
}
export function orderBy(

@@ -138,0 +142,0 @@ expr: qb.Expr,

@@ -65,2 +65,3 @@ import * as r from 'ramda';

where?: Expr;
group_by?: Expr[];
order_by?: OrderBy;

@@ -95,2 +96,3 @@ limit?: number;

'where',
'group_by',
'order_by',

@@ -454,2 +456,7 @@ 'limit',

where: (expr: Expr) => SQL`WHERE `.append(handleExpr(expr)),
group_by: (exprs: Expr[]) =>
appendToStatement(
SQL`GROUP BY `,
r.intersperse<string | SQLStatement>(', ', r.map(handleExpr, exprs))
),
order_by: (orderBy: OrderBy) =>

@@ -549,3 +556,3 @@ appendToStatement(

(sql, clauseKey) => sql.append(' ').append(clauseToSql(m, clauseKey)),
SQL``.append(clauseToSql(m, r.head(sortedClauses))),
SQL``.append(clauseToSql(m, r.head(sortedClauses) as string)),
r.tail(sortedClauses)

@@ -552,0 +559,0 @@ );

@@ -109,2 +109,3 @@ import {expect} from 'chai';

),
h.groupBy(['t.id']),
h.orderBy('at.id'),

@@ -130,2 +131,3 @@ h.limit(5),

],
group_by: ['t.id'],
order_by: [['at.id', 'ASC', 'NULLS LAST']],

@@ -132,0 +134,0 @@ limit: 5,

@@ -100,2 +100,3 @@ import {expect} from 'chai';

],
group_by: ['t.id'],
order_by: [['at.id', 'ASC', 'NULLS LAST']],

@@ -112,2 +113,3 @@ limit: 5,

' WHERE ("t"."col1" = 3 AND ("t"."col2" = $1 OR "t"."col3" = $2))' +
' GROUP BY "t"."id"' +
' ORDER BY "at"."id" ASC NULLS LAST' +

@@ -114,0 +116,0 @@ ' LIMIT 5' +

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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