table overview

Represents a table in the database. It stores type information of the table Alias and Selection. It also stores the table name and the alias.

Added in v2.0.0

Table of contents
  1. table overview
  2. utils
    1. Table (class)
      1. clickhouse (property)
      2. select (property)
      3. selectStar (property)
      4. commaJoin (property)
      5. join (property)
      6. apply (property)
      7. as (property)

utils

Table (class)

Represents a table in the database. It stores type information of the table Alias and Selection. It also stores the table name and the alias.

This class is not meant to be used directly, but rather through the table function.

Signature

export declare class Table<Selection, Alias, Scope, FlatScope> {
  private constructor(
    /* @internal */
    public __props: {
      readonly columns: ReadonlyArray<string>;
      readonly alias: string;
      readonly name: string;
      readonly final: boolean;
      readonly scope: ScopeStorage;
    }
  );
}

Added in v2.0.0

clickhouse (property)

Signature

clickhouse: {
  final: () => Table<Selection, Alias, Scope, FlatScope>;
}

Added in v2.0.0

select (property)

Signature

select: <
  NewSelection extends string = never,
  SubSelection extends Selection = never
>(
  _:
    | readonly SubSelection[]
    | ((
        fields: RecordOfSelection<Selection> &
          SelectionOfScope<Scope> &
          NoSelectFieldsCompileError
      ) => Record<NewSelection, SafeString>)
) => SelectStatement<NewSelection | SubSelection, never, Scope, FlatScope>;

Added in v2.0.0

selectStar (property)

Signature

selectStar: () => SelectStatement<Selection, never, Scope, FlatScope>;

Added in v2.0.0

commaJoin (property)

Signature

commaJoin: <
  Selection2 extends string = never,
  Alias2 extends string = never,
  Scope2 extends ScopeShape = never,
  FlatScope2 extends string = never
>(
  _: ValidAliasInSelection<
    Joinable<Selection2, Alias2, Scope2, FlatScope2>,
    Alias2
  >
) =>
  Joined<
    never,
    never,
    { [key in Alias]: Selection } & { [key in Alias2]: Selection2 },
    Selection | Selection2
  >;

Added in v2.0.0

join (property)

Signature

join: <
  Selection2 extends string = never,
  Alias2 extends string = never,
  Scope2 extends ScopeShape = never,
  FlatScope2 extends string = never
>(
  operator: string,
  _: ValidAliasInSelection<
    Joinable<Selection2, Alias2, Scope2, FlatScope2>,
    Alias2
  >
) =>
  JoinedFactory<
    { [key in Alias]: Selection } & { [key in Alias2]: Selection2 },
    Extract<Selection, Selection2>
  >;

Added in v2.0.0

apply (property)

Signature

apply: <Ret extends TableOrSubquery<any, any, any, any> = never>(
  fn: (it: this) => Ret
) => Ret;

Added in v2.0.0

as (property)

Signature

as: <NewAlias extends string = never>(as: NewAlias) =>
  Table<Selection, NewAlias, Scope, FlatScope>;

Added in v2.0.0