| 811 | |
| 812 | // Helper methods |
| 813 | private _getCurrentAliases(): Array<string> { |
| 814 | const aliases: Array<string> = [] |
| 815 | |
| 816 | // Add the from alias |
| 817 | if (this.query.from) { |
| 818 | if (this.query.from.type === `unionFrom`) { |
| 819 | aliases.push(...this.query.from.sources.map((source) => source.alias)) |
| 820 | } else if (this.query.from.type === `unionAll`) { |
| 821 | aliases.push(`*`) |
| 822 | } else { |
| 823 | aliases.push(this.query.from.alias) |
| 824 | } |
| 825 | } |
| 826 | |
| 827 | // Add join aliases |
| 828 | if (this.query.join) { |
| 829 | for (const join of this.query.join) { |
| 830 | aliases.push(join.from.alias) |
| 831 | } |
| 832 | } |
| 833 | |
| 834 | return aliases |
| 835 | } |
| 836 | |
| 837 | /** |
| 838 | * Functional variants of the query builder |