Libraries v5.0.0
    Preparing search index...

    Interface QueryScope<S>

    Shape-preserving immutable API supplied to named and default scopes.

    interface QueryScope<S extends ReadObject> {
        "[PARAMETER_READER]": ScopeParameterReader;
        "[PARAMETER_STATE]": [];
        addReadPredicate(predicate: ReadPredicate): any;
        andWhere<
            G extends
                ReadPredicateBuilder<ReadColumns<S, keyof ReadRelations<S>>, any>,
        >(
            group: ReadPredicateGroup<
                ReadColumns<S, keyof ReadRelations<S>>,
                G & CheckParameterState<
                    AppendOrigins<[], ParametersOf<NoInfer<G>>, "root">,
                >,
            >,
        ): QueryScope<S>;
        andWhere<
            const V extends
                Partial<Record<keyof ReadColumns<S, keyof ReadRelations<S>>, unknown>>,
        >(
            values: V & WithoutParameters<NoInfer<V>>,
        ): QueryScope<S>;
        andWhere<S extends string | ((columns: C) => AliasedColumn<any>), const A>(
            column: S,
            value: A & CheckScalarParameter<
                [],
                NoInfer<A>,
                PredicateValue<ReadColumns<S, keyof ReadRelations<S>>, S>,
            >,
        ): QueryScope<S>;
        andWhere<S extends string | ((columns: C) => AliasedColumn<any>), const A>(
            column: S,
            operator: string,
            value: A & CheckScalarParameter<
                [],
                NoInfer<A>,
                PredicateValue<ReadColumns<S, keyof ReadRelations<S>>, S>,
            >,
        ): QueryScope<S>;
        limit(count: number): this;
        offset(count: number): this;
        orderBy(
            column: ReadPredicateSelector<ReadColumns<S, keyof ReadRelations<S>>>,
            direction?: "desc" | "asc",
        ): this;
        orderByRaw(sql: string, bindings?: readonly RawBinding[]): this;
        orWhere<
            G extends
                ReadPredicateBuilder<ReadColumns<S, keyof ReadRelations<S>>, any>,
        >(
            group: ReadPredicateGroup<
                ReadColumns<S, keyof ReadRelations<S>>,
                G & CheckParameterState<
                    AppendOrigins<[], ParametersOf<NoInfer<G>>, "root">,
                >,
            >,
        ): QueryScope<S>;
        orWhere<
            const V extends
                Partial<Record<keyof ReadColumns<S, keyof ReadRelations<S>>, unknown>>,
        >(
            values: V & WithoutParameters<NoInfer<V>>,
        ): QueryScope<S>;
        orWhere<S extends string | ((columns: C) => AliasedColumn<any>), const A>(
            column: S,
            value: A & CheckScalarParameter<
                [],
                NoInfer<A>,
                PredicateValue<ReadColumns<S, keyof ReadRelations<S>>, S>,
            >,
        ): QueryScope<S>;
        orWhere<S extends string | ((columns: C) => AliasedColumn<any>), const A>(
            column: S,
            operator: string,
            value: A & CheckScalarParameter<
                [],
                NoInfer<A>,
                PredicateValue<ReadColumns<S, keyof ReadRelations<S>>, S>,
            >,
        ): QueryScope<S>;
        orWhereExists(query: QueryBuilder): QueryScope<S>;
        orWhereIn<
            S extends string
            | ((columns: C) => AliasedColumn<any>),
            const A extends ReadMembership,
        >(
            column: S,
            values: A & CheckParameterValue<
                [],
                NoInfer<A>,
                PredicateValue<ReadColumns<S, keyof ReadRelations<S>>, S>,
            >,
        ): QueryScope<S>;
        orWhereNotExists(query: QueryBuilder): QueryScope<S>;
        orWhereNotIn<
            S extends string
            | ((columns: C) => AliasedColumn<any>),
            const A extends ReadMembership,
        >(
            column: S,
            values: A & CheckParameterValue<
                [],
                NoInfer<A>,
                PredicateValue<ReadColumns<S, keyof ReadRelations<S>>, S>,
            >,
        ): QueryScope<S>;
        orWhereNotNull(
            column: ReadPredicateSelector<ReadColumns<S, keyof ReadRelations<S>>>,
        ): QueryScope<S>;
        orWhereNull(
            column: ReadPredicateSelector<ReadColumns<S, keyof ReadRelations<S>>>,
        ): QueryScope<S>;
        orWhereRaw<const A extends readonly RawBinding[]>(
            sql: string,
            bindings: A & WithoutParameters<NoInfer<A>>,
        ): QueryScope<S>;
        orWhereRaw(sql: string): QueryScope<S>;
        readPredicateContext(): ReadPredicateContext<
            ReadColumns<S, keyof ReadRelations<S>>,
        >;
        ref(
            selector: ReadPredicateSelector<ReadColumns<S, keyof ReadRelations<S>>>,
        ): Raw<any> | Ref<string, {}>;
        where<
            G extends
                ReadPredicateBuilder<ReadColumns<S, keyof ReadRelations<S>>, any>,
        >(
            group: ReadPredicateGroup<
                ReadColumns<S, keyof ReadRelations<S>>,
                G & CheckParameterState<
                    AppendOrigins<[], ParametersOf<NoInfer<G>>, "root">,
                >,
            >,
        ): QueryScope<S>;
        where<
            const V extends
                Partial<Record<keyof ReadColumns<S, keyof ReadRelations<S>>, unknown>>,
        >(
            values: V & WithoutParameters<NoInfer<V>>,
        ): QueryScope<S>;
        where<S extends string | ((columns: C) => AliasedColumn<any>), const A>(
            column: S,
            value: A & CheckScalarParameter<
                [],
                NoInfer<A>,
                PredicateValue<ReadColumns<S, keyof ReadRelations<S>>, S>,
            >,
        ): QueryScope<S>;
        where<S extends string | ((columns: C) => AliasedColumn<any>), const A>(
            column: S,
            operator: string,
            value: A & CheckScalarParameter<
                [],
                NoInfer<A>,
                PredicateValue<ReadColumns<S, keyof ReadRelations<S>>, S>,
            >,
        ): QueryScope<S>;
        whereBetween<
            S extends string
            | ((columns: C) => AliasedColumn<any>),
            const A extends readonly [unknown, unknown],
        >(
            column: S,
            range: A & CheckParameterValue<
                [],
                NoInfer<A>,
                PredicateValue<ReadColumns<S, keyof ReadRelations<S>>, S>,
            >,
        ): QueryScope<S>;
        whereExists(query: QueryBuilder): QueryScope<S>;
        whereILike<
            S extends string
            | ((columns: C) => AliasedColumn<any>),
            const A,
        >(
            column: S,
            value: A & (
                A extends QueryParameter<string>
                    ? CheckParameterValue<
                        [],
                        NoInfer<A>,
                        PredicateValue<ReadColumns<S, keyof ReadRelations<S>>, S>,
                    >
                    : string
            ),
        ): QueryScope<S>;
        whereIn<
            S extends string
            | ((columns: C) => AliasedColumn<any>),
            const A extends ReadMembership,
        >(
            column: S,
            values: A & CheckParameterValue<
                [],
                NoInfer<A>,
                PredicateValue<ReadColumns<S, keyof ReadRelations<S>>, S>,
            >,
        ): QueryScope<S>;
        whereJsonPath<A>(
            column: ReadPredicateSelector<ReadColumns<S, keyof ReadRelations<S>>>,
            path: string,
            operator?: string,
            value?: A & WithoutParameters<NoInfer<A>>,
        ): QueryScope<S>;
        whereLike<S extends string | ((columns: C) => AliasedColumn<any>), const A>(
            column: S,
            value: A & (
                A extends QueryParameter<string>
                    ? CheckParameterValue<
                        [],
                        NoInfer<A>,
                        PredicateValue<ReadColumns<S, keyof ReadRelations<S>>, S>,
                    >
                    : string
            ),
        ): QueryScope<S>;
        whereNot<S extends string | ((columns: C) => AliasedColumn<any>), const A>(
            column: S,
            value: A & CheckScalarParameter<
                [],
                NoInfer<A>,
                PredicateValue<ReadColumns<S, keyof ReadRelations<S>>, S>,
            >,
        ): QueryScope<S>;
        whereNotBetween<
            S extends string
            | ((columns: C) => AliasedColumn<any>),
            const A extends readonly [unknown, unknown],
        >(
            column: S,
            range: A & CheckParameterValue<
                [],
                NoInfer<A>,
                PredicateValue<ReadColumns<S, keyof ReadRelations<S>>, S>,
            >,
        ): QueryScope<S>;
        whereNotExists(query: QueryBuilder): QueryScope<S>;
        whereNotIn<
            S extends string
            | ((columns: C) => AliasedColumn<any>),
            const A extends ReadMembership,
        >(
            column: S,
            values: A & CheckParameterValue<
                [],
                NoInfer<A>,
                PredicateValue<ReadColumns<S, keyof ReadRelations<S>>, S>,
            >,
        ): QueryScope<S>;
        whereNotNull(
            column: ReadPredicateSelector<ReadColumns<S, keyof ReadRelations<S>>>,
        ): QueryScope<S>;
        whereNull(
            column: ReadPredicateSelector<ReadColumns<S, keyof ReadRelations<S>>>,
        ): QueryScope<S>;
        whereRaw<const A extends readonly RawBinding[]>(
            sql: string,
            bindings: A & WithoutParameters<NoInfer<A>>,
        ): QueryScope<S>;
        whereRaw(sql: string): QueryScope<S>;
    }

    Type Parameters

    Hierarchy

    Index
    "[PARAMETER_READER]": ScopeParameterReader

    Type-only fluent return constructor.

    "[PARAMETER_STATE]": []

    Type-only ordered argument contract.

    • Append trusted ordering with captured bindings.

      Parameters

      • sql: string
      • Optionalbindings: readonly RawBinding[]

      Returns this

    • Type Parameters

      Parameters

      • column: S
      • value: A & (
            A extends QueryParameter<string>
                ? CheckParameterValue<
                    [],
                    NoInfer<A>,
                    PredicateValue<ReadColumns<S, keyof ReadRelations<S>>, S>,
                >
                : string
        )

      Returns QueryScope<S>

    • Type Parameters

      Parameters

      • column: S
      • value: A & (
            A extends QueryParameter<string>
                ? CheckParameterValue<
                    [],
                    NoInfer<A>,
                    PredicateValue<ReadColumns<S, keyof ReadRelations<S>>, S>,
                >
                : string
        )

      Returns QueryScope<S>

    • Trusted SQL with concrete bindings; use a typed predicate for placeholders.

      Type Parameters

      • const A extends readonly RawBinding[]

      Parameters

      • sql: string
      • bindings: A & WithoutParameters<NoInfer<A>>

      Returns QueryScope<S>

    • Trusted SQL with concrete bindings; use a typed predicate for placeholders.

      Parameters

      • sql: string

      Returns QueryScope<S>