Polyglot SQL API Documentation - v0.2.0
    Preparing search index...

    Class SelectBuilder

    Fluent builder for SELECT queries.

    const sql = select('id', 'name')
    .from('users')
    .where(col('status').eq(lit('active')))
    .orderBy(col('name').asc())
    .limit(10)
    .toSql('postgresql');
    Index

    Constructors

    Methods

    • Return the Expression AST as a plain JS object.

      Returns any

    • Add a CROSS JOIN.

      Parameters

      • tableName: string

      Returns this

    • Convert to CREATE TABLE AS SELECT and return the AST. This is a terminal operation that consumes the builder.

      Parameters

      • tableName: string

      Returns any

    • Convert to CREATE TABLE AS SELECT and return generated SQL. This is a terminal operation that consumes the builder.

      Parameters

      • tableName: string
      • dialect: string = 'generic'

      Returns string

    • Add FOR UPDATE locking.

      Returns this

    • Free the underlying WASM handle.

      Returns void

    • Set the FROM clause.

      Parameters

      • tableOrExpr: string | Expr

      Returns this

    • Add a query hint (e.g. Oracle hint expressions).

      Parameters

      • text: string

      Returns this

    • Add a LATERAL VIEW clause (Hive/Spark UDTF expansion).

      Parameters

      • funcExpr: Expr
      • tableAlias: string
      • colAliases: string[]

      Returns this

    • Set the LIMIT.

      Parameters

      • n: number

      Returns this

    • Set the OFFSET.

      Parameters

      • n: number

      Returns this

    • Add columns to the SELECT list. Accepts Expr, strings (→ col), or '*'.

      Parameters

      Returns this

    • Set the SORT BY clause (Hive/Spark — sorts within each partition).

      Parameters

      Returns this

    • Generate SQL string. Defaults to generic dialect.

      Parameters

      • dialect: string = 'generic'

      Returns string