The Query Builder interface for building queries for the IDatabaseTable.

interface IQueryBuilder {
    getQuery(): IDatabaseTableQuery;
    limit(limit: number): IQueryBuilder;
    offset(offset: number): IQueryBuilder;
    orderBy(order: "asc" | "desc"): IQueryBuilder;
    where(operator:
        | "=="
        | "!="
        | ">"
        | "<"
        | "<="
        | ">=", value: SupportedIndexType): IQueryBuilder;
    where(operator: "in" | "not-in", value: SupportedIndexType[]): IQueryBuilder;
    where(operator: "between", value: [SupportedIndexType, SupportedIndexType]): IQueryBuilder;
}

Methods

  • Adds a limit to the query.

    Parameters

    • limit: number

      The limit for the query.

    Returns IQueryBuilder

    A QueryBuilder instance with a limit added.

    an SDKClientError with the code SDKClientErrorCodes.QueryBuilderInvalidArgument if the limit is not a positive number.

  • Adds an offset to the query.

    Parameters

    • offset: number

      The offset for the query.

    Returns IQueryBuilder

    A QueryBuilder instance with an offset added.

    an SDKClientError with the code SDKClientErrorCodes.QueryBuilderInvalidArgument and a descriptive message if the offset is not a positive number.

  • Adds an order by clause to the query.

    Parameters

    • order: "asc" | "desc"

      The order for the order by clause, either 'asc' or 'desc'.

    Returns IQueryBuilder

    A QueryBuilder instance with an order by clause added.

    an SDKClientError with the code SDKClientErrorCodes.QueryBuilderInvalidArgument if the order is not 'asc' or 'desc'.

  • A where clause with basic operators and a single value.

    Parameters

    • operator:
          | "=="
          | "!="
          | ">"
          | "<"
          | "<="
          | ">="

      A basic operator.

    • value: SupportedIndexType

      A single value.

    Returns IQueryBuilder

    A QueryBuilder instance with a where clause added.

  • A where clause with 'in' or 'not-in' the given values.

    Parameters

    • operator: "in" | "not-in"

      An 'in' or 'not-in' operator.

    • value: SupportedIndexType[]

      An array of values.

    Returns IQueryBuilder

    A QueryBuilder instance with a where clause added.

  • A where clause with 'between' the given values.

    Parameters

    Returns IQueryBuilder

    A QueryBuilder instance with a where clause added.