A QueryBuilder helper for building queries for the IDatabaseTable.

Implements

  • IQueryBuilder

Methods

  • Gets the query.

    Returns IDatabaseTableQuery

  • Adds a limit to the query.

    Parameters

    • limit: number

      The limit for the query.

    Returns QueryBuilder

    A QueryBuilder instance with a limit added.

    Throws

    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 QueryBuilder

    A QueryBuilder instance with an offset added.

    Throws

    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 QueryBuilder

    A QueryBuilder instance with an order by clause added.

    Throws

    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 QueryBuilder

    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 QueryBuilder

    A QueryBuilder instance with a where clause added.

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

    Parameters

    • operator: "between"

      A 'between' operator.

    • value: [SupportedIndexType, SupportedIndexType]

      An array of two values.

    Returns QueryBuilder

    A QueryBuilder instance with a where clause added.

  • Builds a query.

    Parameters

    • query: IDatabaseTableQuery

      The query to build.

    Returns QueryBuilder

    A QueryBuilder instance.

    Throws

    an SDKClientError with the code SDKClientErrorCodes.QueryBuilderInvalidArgument and a descriptive message if the query is invalid.

  • The index key to query on. This is the method to call to initiate any query.

    Parameters

    • key: string

      The index key to query on.

    Returns QueryBuilder

    A QueryBuilder instance.

    Throws

    an SDKClientError with the code SDKClientErrorCodes.QueryBuilderInvalidArgument and a descriptive message if the query is invalid.

  • Validates a query.

    Parameters

    • query: IDatabaseTableQuery

      The query to validate.

    Returns boolean

    Whether the query is valid.

    Throws

    an SDKClientError with the code SDKClientErrorCodes.QueryBuilderInvalidArgument and a descriptive message if the query is invalid.

Generated using TypeDoc