prorm API Reference
    Preparing search index...

    Interface SelectOptions

    Everything a SELECT can carry once associations have been resolved: columns, joins, filtering, grouping, ordering, pagination and locking. This is the dialect-facing form of FindOptions.

    interface SelectOptions {
        tableName: string;
        schema?: string;
        attributes?: string[] | { include?: string[]; exclude?: string[] };
        where?: WhereOptions;
        include?: IncludeOptions[];
        order?: Order;
        limit?: string | number;
        offset?: string | number;
        group?: string | string[];
        having?: WhereOptions;
        raw?: boolean;
        lock?: any;
        subQuery?: boolean;
        benchmark?: boolean;
        distinct?: boolean;
        col?: string;
        distinctOn?: string[];
        duplicate?: boolean;
        unionType?: "UNION" | "UNION ALL" | "EXCEPT" | "INTERSECT";
        union?: {
            model: any;
            where?: WhereOptions;
            attributes?: string[] | { include?: string[]; exclude?: string[] };
            order?: Order;
            limit?: string | number;
            offset?: string | number;
            include?: IncludeOptions[];
            as?: string;
        }[];
        cte?: CTEOption[];
        sample?: { method: "BERNOULLI"
        | "SYSTEM"; percent: number; seed?: number };
    }
    Index
    tableName: string
    schema?: string

    Schema to use for the table

    attributes?: string[] | { include?: string[]; exclude?: string[] }
    where?: WhereOptions
    include?: IncludeOptions[]
    order?: Order
    limit?: string | number
    offset?: string | number
    group?: string | string[]
    having?: WhereOptions
    raw?: boolean
    lock?: any
    subQuery?: boolean
    benchmark?: boolean
    distinct?: boolean
    col?: string

    Column to use with DISTINCT for count queries (e.g., COUNT(DISTINCT col))

    distinctOn?: string[]
    duplicate?: boolean

    When true, uses table aliases to distinguish duplicate column names This is needed when including multiple tables that have columns with the same name

    unionType?: "UNION" | "UNION ALL" | "EXCEPT" | "INTERSECT"

    UNION type for combining multiple queries

    union?: {
        model: any;
        where?: WhereOptions;
        attributes?: string[] | { include?: string[]; exclude?: string[] };
        order?: Order;
        limit?: string | number;
        offset?: string | number;
        include?: IncludeOptions[];
        as?: string;
    }[]

    Array of union queries to combine with the main query

    cte?: CTEOption[]

    Common Table Expressions (CTEs) to prepend to the query as a WITH clause. Each entry becomes name [(columns)] AS (query). If any entry sets recursive: true, the whole clause is emitted as WITH RECURSIVE.

    sample?: { method: "BERNOULLI" | "SYSTEM"; percent: number; seed?: number }

    PostgreSQL TABLESAMPLE clause, appended right after the FROM table: FROM table TABLESAMPLE BERNOULLI(10) REPEATABLE(seed). percent is the sampling percentage (0-100). seed, if provided, produces a repeatable sample via REPEATABLE(seed).