Skip to content

Commit

Permalink
improve join types (#33)
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasavila00 authored Jul 1, 2022
1 parent d242c2a commit fa0ae6d
Show file tree
Hide file tree
Showing 24 changed files with 156 additions and 696 deletions.
8 changes: 8 additions & 0 deletions docs/api/classes/compound.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ joinTable: <
table: Table<Selection2, Alias2>
) =>
JoinedFactory<
Selection,
| Exclude<Selection, Selection2>
| Exclude<Selection2, Selection>
| `${Alias1}.${Selection}`
Expand All @@ -136,6 +137,7 @@ commaJoinTable: <
table: Table<Selection2, Alias2>
) =>
Joined<
Selection,
| Exclude<Selection, Selection2>
| Exclude<Selection2, Selection>
| `${Alias1}.${Selection}`
Expand Down Expand Up @@ -163,6 +165,7 @@ joinStringifiedSelect: <
select: StringifiedSelectStatement<Selection2>
) =>
JoinedFactory<
Selection,
| Exclude<Selection, Selection2>
| Exclude<Selection2, Selection>
| `${Alias2}.${Selection2}`
Expand Down Expand Up @@ -192,6 +195,7 @@ joinSelect: <
select: SelectStatement<Scope2, Selection2>
) =>
JoinedFactory<
Selection,
| Exclude<Selection, Selection2>
| Exclude<Selection2, Selection>
| `${Alias2}.${Selection2}`
Expand Down Expand Up @@ -219,6 +223,7 @@ commaJoinStringifiedSelect: <
select: StringifiedSelectStatement<Selection2>
) =>
Joined<
Selection,
| Exclude<Selection, Selection2>
| Exclude<Selection2, Selection>
| `${Alias2}.${Selection2}`
Expand Down Expand Up @@ -246,6 +251,7 @@ commaJoinSelect: <
select: SelectStatement<Scope2, Selection2>
) =>
Joined<
Selection,
| Exclude<Selection, Selection2>
| Exclude<Selection2, Selection>
| `${Alias2}.${Selection2}`
Expand Down Expand Up @@ -274,6 +280,7 @@ joinCompound: <
compound: Compound<Scope2, Selection2>
) =>
JoinedFactory<
Selection,
| Exclude<Selection, Selection2>
| Exclude<Selection2, Selection>
| `${Alias2}.${Selection2}`
Expand Down Expand Up @@ -302,6 +309,7 @@ commaJoinCompound: <
compound: Compound<Scope2, Selection2>
) =>
Joined<
Selection,
| Exclude<Selection, Selection2>
| Exclude<Selection2, Selection>
| `${Alias2}.${Selection2}`
Expand Down
41 changes: 30 additions & 11 deletions docs/api/classes/joined.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ This class is not meant to be used directly, but rather through methods in table
**Signature**

```ts
export declare class Joined<Selection, Aliases, Ambiguous> {
export declare class Joined<Selection, Scope, Aliases, Ambiguous> {
private constructor(
/* @internal */
public __props: {
Expand All @@ -51,9 +51,9 @@ Added in v0.0.0
```ts
select: <NewSelection extends string>(
f: (
f: Record<Selection, SafeString> & NoSelectFieldsCompileError
f: Record<Selection | Scope, SafeString> & NoSelectFieldsCompileError
) => Record<NewSelection, SafeString>
) => SelectStatement<Selection, NewSelection>;
) => SelectStatement<Selection | Scope, NewSelection>;
```
Added in v0.0.0
Expand All @@ -63,7 +63,7 @@ Added in v0.0.0
**Signature**
```ts
selectStar: () => SelectStatement<Selection, Selection>;
selectStar: () => SelectStatement<Selection | Scope, Selection>;
```
Added in v0.0.0
Expand All @@ -75,8 +75,10 @@ Added in v0.0.0
```ts
selectStarOfAliases: <TheAliases extends Aliases>(aliases: TheAliases[]) =>
SelectStatement<
RemoveAliasFromSelection<TheAliases, Selection>,
RemoveAliasFromSelection<TheAliases, Selection>
| RemoveAliasFromSelection<TheAliases, Selection>
| RemoveAliasFromSelection<TheAliases, Scope>,
| RemoveAliasFromSelection<TheAliases, Selection>
| RemoveAliasFromSelection<TheAliases, Scope>
>;
```
Expand All @@ -91,6 +93,8 @@ commaJoinTable: <Selection2 extends string, Alias2 extends string>(
table: Table<Selection2, Alias2>
) =>
Joined<
Selection,
| Scope
| Exclude<Selection, Selection2>
| Exclude<Exclude<Selection2, Selection>, Ambiguous>
| Exclude<Selection2, Ambiguous>
Expand All @@ -112,6 +116,8 @@ joinTable: <Selection2 extends string, Alias2 extends string>(
table: Table<Selection2, Alias2>
) =>
JoinedFactory<
Selection,
| Scope
| Exclude<Selection, Selection2>
| Exclude<Exclude<Selection2, Selection>, Ambiguous>
| `${Alias2}.${Selection2}`,
Expand All @@ -133,6 +139,8 @@ commaJoinStringifiedSelect: <Selection2 extends string, Alias2 extends string>(
select: StringifiedSelectStatement<Selection2>
) =>
Joined<
Selection,
| Scope
| Exclude<Selection, Selection2>
| Exclude<Exclude<Selection2, Selection>, Ambiguous>
| `${Alias2}.${Selection2}`,
Expand All @@ -157,6 +165,8 @@ commaJoinSelect: <
select: SelectStatement<Scope2, Selection2>
) =>
Joined<
Selection,
| Scope
| Exclude<Selection, Selection2>
| Exclude<Exclude<Selection2, Selection>, Ambiguous>
| `${Alias2}.${Selection2}`,
Expand All @@ -178,6 +188,8 @@ joinStringifiedSelect: <Selection2 extends string, Alias2 extends string>(
table: StringifiedSelectStatement<Selection2>
) =>
JoinedFactory<
Selection,
| Scope
| Exclude<Selection, Selection2>
| Exclude<Exclude<Selection2, Selection>, Ambiguous>
| `${Alias2}.${Selection2}`,
Expand All @@ -204,6 +216,8 @@ joinSelect: <
table: SelectStatement<Scope2, Selection2>
) =>
JoinedFactory<
Selection,
| Scope
| Exclude<Selection, Selection2>
| Exclude<Exclude<Selection2, Selection>, Ambiguous>
| `${Alias2}.${Selection2}`,
Expand All @@ -229,6 +243,8 @@ commaJoinCompound: <
compound: Compound<Scope2, Selection2>
) =>
Joined<
Selection,
| Scope
| Exclude<Selection, Selection2>
| Exclude<Exclude<Selection2, Selection>, Ambiguous>
| `${Alias2}.${Selection2}`,
Expand All @@ -254,6 +270,8 @@ joinCompound: <
compound: Compound<Scope2, Selection2>
) =>
JoinedFactory<
Selection,
| Scope
| Exclude<Selection, Selection2>
| Exclude<Exclude<Selection2, Selection>, Ambiguous>
| `${Alias2}.${Selection2}`,
Expand All @@ -275,6 +293,7 @@ Allows the selection of the constraint to be done in another method call.
```ts
export declare class JoinedFactory<
Selection,
Scope,
Aliases,
Ambiguous,
UsingPossibleKeys
Expand All @@ -297,7 +316,7 @@ Added in v0.0.0
**Signature**
```ts
noConstraint: () => Joined<Selection, Aliases, Ambiguous>;
noConstraint: () => Joined<Selection, Scope, Aliases, Ambiguous>;
```
Added in v0.0.0
Expand All @@ -307,9 +326,8 @@ Added in v0.0.0
**Signature**
```ts
on: (
on: (fields: Record<Selection, SafeString>) => SafeString | SafeString[]
) => Joined<Selection, Aliases, Ambiguous>;
on: (on: (fields: Record<Scope, SafeString>) => SafeString | SafeString[]) =>
Joined<Selection, Scope, Aliases, Ambiguous>;
```
Added in v0.0.0
Expand All @@ -319,7 +337,8 @@ Added in v0.0.0
**Signature**
```ts
using: (keys: UsingPossibleKeys[]) => Joined<Selection, Aliases, Ambiguous>;
using: (keys: UsingPossibleKeys[]) =>
Joined<Selection, Scope, Aliases, Ambiguous>;
```
Added in v0.0.0
8 changes: 8 additions & 0 deletions docs/api/classes/select-statement.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ commaJoinTable: <
table: Table<Selection2, Alias2>
) =>
Joined<
Selection,
| Exclude<Selection, Selection2>
| Exclude<Selection2, Selection>
| `${Alias1}.${Selection}`,
Expand All @@ -238,6 +239,7 @@ joinTable: <
table: Table<Selection2, Alias2>
) =>
JoinedFactory<
Selection,
| Exclude<Selection, Selection2>
| Exclude<Selection2, Selection>
| `${Alias1}.${Selection}`
Expand Down Expand Up @@ -265,6 +267,7 @@ commaJoinStringifiedSelect: <
select: StringifiedSelectStatement<Selection2>
) =>
Joined<
Selection,
| Exclude<Selection, Selection2>
| Exclude<Selection2, Selection>
| `${Alias2}.${Selection2}`
Expand Down Expand Up @@ -292,6 +295,7 @@ commaJoinSelect: <
select: SelectStatement<Scope2, Selection2>
) =>
Joined<
Selection,
| Exclude<Selection, Selection2>
| Exclude<Selection2, Selection>
| `${Alias2}.${Selection2}`
Expand Down Expand Up @@ -319,6 +323,7 @@ joinStringifiedSelect: <
select: StringifiedSelectStatement<Selection2>
) =>
JoinedFactory<
Selection,
| Exclude<Selection, Selection2>
| Exclude<Selection2, Selection>
| `${Alias2}.${Selection2}`
Expand Down Expand Up @@ -348,6 +353,7 @@ joinSelect: <
select: SelectStatement<Scope2, Selection2>
) =>
JoinedFactory<
Selection,
| Exclude<Selection, Selection2>
| Exclude<Selection2, Selection>
| `${Alias2}.${Selection2}`
Expand Down Expand Up @@ -375,6 +381,7 @@ commaJoinCompound: <
compound: Compound<Selection2, Selection2>
) =>
Joined<
Selection,
| Exclude<Selection, Selection2>
| Exclude<Selection2, Selection>
| `${Alias1}.${Selection}`
Expand Down Expand Up @@ -402,6 +409,7 @@ joinCompound: <
compound: Compound<Selection2, Selection2>
) =>
JoinedFactory<
Selection,
| Exclude<Selection, Selection2>
| Exclude<Selection2, Selection>
| `${Alias1}.${Selection}`
Expand Down
8 changes: 8 additions & 0 deletions docs/api/classes/stringified-select-statement.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ commaJoinTable: <
table: Table<Selection2, Alias2>
) =>
Joined<
Selection,
| Exclude<Selection, Selection2>
| Exclude<Selection2, Selection>
| `${Alias1}.${Selection}`,
Expand All @@ -105,6 +106,7 @@ joinTable: <
table: Table<Selection2, Alias2>
) =>
JoinedFactory<
Selection,
| Exclude<Selection, Selection2>
| Exclude<Selection2, Selection>
| `${Alias1}.${Selection}`
Expand Down Expand Up @@ -132,6 +134,7 @@ commaJoinStringifiedSelect: <
select: StringifiedSelectStatement<Selection2>
) =>
Joined<
Selection,
| Exclude<Selection, Selection2>
| Exclude<Selection2, Selection>
| `${Alias2}.${Selection2}`
Expand Down Expand Up @@ -159,6 +162,7 @@ commaJoinSelect: <
select: SelectStatement<Scope2, Selection2>
) =>
Joined<
Selection,
| Exclude<Selection, Selection2>
| Exclude<Selection2, Selection>
| `${Alias2}.${Selection2}`
Expand Down Expand Up @@ -186,6 +190,7 @@ joinStringifiedSelect: <
select: StringifiedSelectStatement<Selection2>
) =>
JoinedFactory<
Selection,
| Exclude<Selection, Selection2>
| Exclude<Selection2, Selection>
| `${Alias2}.${Selection2}`
Expand Down Expand Up @@ -215,6 +220,7 @@ joinSelect: <
select: SelectStatement<Scope2, Selection2>
) =>
JoinedFactory<
Selection,
| Exclude<Selection, Selection2>
| Exclude<Selection2, Selection>
| `${Alias2}.${Selection2}`
Expand Down Expand Up @@ -242,6 +248,7 @@ commaJoinCompound: <
compound: Compound<Selection2, Selection2>
) =>
Joined<
Selection,
| Exclude<Selection, Selection2>
| Exclude<Selection2, Selection>
| `${Alias1}.${Selection}`
Expand Down Expand Up @@ -269,6 +276,7 @@ joinCompound: <
compound: Compound<Selection2, Selection2>
) =>
JoinedFactory<
Selection,
| Exclude<Selection, Selection2>
| Exclude<Selection2, Selection>
| `${Alias1}.${Selection}`
Expand Down
Loading

0 comments on commit fa0ae6d

Please sign in to comment.