MCPcopy Create free account
hub / github.com/Openpanel-dev/openpanel / merge

Method merge

packages/db/src/clickhouse/query-builder.ts:600–642  ·  view source on GitHub ↗
(query: Query)

Source from the content-addressed store, hash-verified

598
599 // Add merge method
600 merge(query: Query): this {
601 if (this._skipNext) {
602 return this;
603 }
604
605 this._from = query._from;
606
607 this._select = [...this._select, ...query._select];
608
609 this._except = [...this._except, ...query._except];
610
611 // Merge WHERE conditions
612 this._where = [...this._where, ...query._where];
613
614 // Merge CTEs
615 this._ctes = [...this._ctes, ...query._ctes];
616
617 // Merge JOINS
618 this._joins = [...this._joins, ...query._joins];
619 this._rawJoins = [...this._rawJoins, ...query._rawJoins];
620
621 // Merge settings
622 this._settings = { ...this._settings, ...query._settings };
623
624 // Take the most restrictive LIMIT
625 if (query._limit !== undefined) {
626 this._limit =
627 this._limit === undefined
628 ? query._limit
629 : Math.min(this._limit, query._limit);
630 }
631
632 // Merge ORDER BY
633 this._orderBy = [...this._orderBy, ...query._orderBy];
634
635 // Merge GROUP BY
636 this._groupBy = [...this._groupBy, ...query._groupBy];
637
638 // Merge HAVING conditions
639 this._having = [...this._having, ...query._having];
640
641 return this;
642 }
643}
644
645// Add this new class for building where groups

Callers 2

cloneMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected