Skip to content

Commit

Permalink
Add JSDoc to WithClause constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
spren9er committed Feb 16, 2025
1 parent dd18cd3 commit 7976b72
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions packages/sql/src/ast/query.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export class Query extends ExprNode {
* @returns {WithClause}
*/
static with(...expr) {
return new WithClause(expr);
return new WithClause(...expr);
}

/**
Expand Down Expand Up @@ -582,7 +582,11 @@ export class SetOperation extends Query {
}

class WithClause {
constructor(expr) {
/**
* Instantiate a new WITH clause instance.
* @param {...import('../types.js').WithExpr} expr The WITH CTE queries.
*/
constructor(...expr) {
this._with = expr;
}

Expand All @@ -592,7 +596,7 @@ class WithClause {
* @returns {SelectQuery}
*/
select(...expr) {
return Query.select(...expr).with(this._with);
return Query.select(...expr).with(...this._with);
}

/**
Expand All @@ -601,7 +605,7 @@ class WithClause {
* @returns {SelectQuery}
*/
from(...expr) {
return Query.from(...expr).with(this._with);
return Query.from(...expr).with(...this._with);
}

/**
Expand All @@ -610,7 +614,7 @@ class WithClause {
* @returns {SetOperation}
*/
union(...queries) {
return Query.union(...queries).with(this._with);
return Query.union(...queries).with(...this._with);
}

/**
Expand All @@ -619,7 +623,7 @@ class WithClause {
* @returns {SetOperation}
*/
unionAll(...queries) {
return Query.unionAll(...queries).with(this._with);
return Query.unionAll(...queries).with(...this._with);
}

/**
Expand All @@ -628,7 +632,7 @@ class WithClause {
* @returns {SetOperation}
*/
intersect(...queries) {
return Query.intersect(...queries).with(this._with);
return Query.intersect(...queries).with(...this._with);
}

/**
Expand All @@ -637,6 +641,6 @@ class WithClause {
* @returns {SetOperation}
*/
except(...queries) {
return Query.except(...queries).with(this._with);
return Query.except(...queries).with(...this._with);
}
}

0 comments on commit 7976b72

Please sign in to comment.