Libraries
    Preparing search index...

    Interface JoinManySpec<TLocalSchema, TForeignSchema, TFieldName>

    interface JoinManySpec<
        TLocalSchema extends
            ObjectSchemaBuilder<any, any, any, any, any, any, any>,
        TForeignSchema extends
            ObjectSchemaBuilder<any, any, any, any, any, any, any>,
        TFieldName extends string = string,
    > {
        as: TFieldName;
        foreignColumn: ColumnRef<TForeignSchema>;
        foreignQuery?: QueryBuilder<any, any> | { toKnexQuery(): QueryBuilder };
        foreignSchema: TForeignSchema;
        limit?: number;
        localColumn: ColumnRef<TLocalSchema>;
        mappers?: Partial<
            Record<SchemaKeys<TForeignSchema>, string | ((value: any) => any)>,
        >;
        offset?: number;
        orderBy?: { column: ColumnRef<TForeignSchema>; direction?: "asc" | "desc" };
    }

    Type Parameters

    • TLocalSchema extends ObjectSchemaBuilder<any, any, any, any, any, any, any>
    • TForeignSchema extends ObjectSchemaBuilder<any, any, any, any, any, any, any>
    • TFieldName extends string = string
    Index

    Properties

    Name of the field that will hold the loaded array in the result

    foreignColumn: ColumnRef<TForeignSchema>

    Column on the foreign table used for the join (string key or property accessor)

    foreignQuery?: QueryBuilder<any, any> | { toKnexQuery(): QueryBuilder }

    Optional Knex query builder for the foreign table — auto-derived from foreignSchema's tableName if omitted

    foreignSchema: TForeignSchema

    Foreign schema for type inference

    limit?: number

    Maximum number of related items to load per parent row

    localColumn: ColumnRef<TLocalSchema>

    Column on the local (base) table used for the join (string key or property accessor)

    mappers?: Partial<
        Record<SchemaKeys<TForeignSchema>, string | ((value: any) => any)>,
    >

    Optional post-load value transformers per foreign column

    offset?: number

    Number of related items to skip per parent row

    orderBy?: { column: ColumnRef<TForeignSchema>; direction?: "asc" | "desc" }

    Column to order the related items by (required for deterministic limit/offset)