Skip to content

Commit

Permalink
Allow pgClassExpressions to be embedded directly into SQL expressions (
Browse files Browse the repository at this point in the history
  • Loading branch information
benjie committed Jun 13, 2024
2 parents 87d3ffd + 590b6fd commit b1ffe28
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
6 changes: 6 additions & 0 deletions .changeset/empty-needles-press.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@dataplan/pg": patch
---

Allow `PgClassExpressionStep` instances to be embedded directly into SQL
expressions.
6 changes: 5 additions & 1 deletion grafast/dataplan-pg/src/steps/pgClassExpression.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { UnbatchedExecutionExtra } from "grafast";
import { access, exportAs, UnbatchedExecutableStep } from "grafast";
import type { SQL } from "pg-sql2";
import sql from "pg-sql2";
import sql, { $$toSQL } from "pg-sql2";

import type { PgResource } from "../datasource.js";
import type {
Expand Down Expand Up @@ -254,6 +254,10 @@ export class PgClassExpressionStep<
);
}

public [$$toSQL](): SQL {
return this.expression;
}

public toSQL(): SQL {
return this.expression;
}
Expand Down

0 comments on commit b1ffe28

Please sign in to comment.