Interface QueryOptions<E, T>

Options for query method.

interface QueryOptions<E, T> {
    filter?: ((item: E) => unknown);
    hashKey?: keyof {
        [Property in string | number | symbol as [T[keyof Exactify<T>]] extends [never]
            ? [NonNullable<(E extends EntityMap
                    ? FlattenEntityMap<E<(...)>>
                    : E)[Property]>] extends [never]
                ? Property
                : never
            : [NonNullable<(E extends EntityMap
                    ? FlattenEntityMap<E<(...)>>
                    : E)[Property]>] extends [never]
                ? never
                : NonNullable<(E extends EntityMap
                        ? FlattenEntityMap<E<(...)>>
                        : E)[Property]> extends T[keyof Exactify<T>]
                    ? Property
                    : never]: never
    };
    hashValue?: T[keyof T];
    indexComponents?: (keyof {
        [Property in string | number | symbol as [T[keyof Exactify<T>]] extends [never]
            ? [NonNullable<(E extends EntityMap
                    ? FlattenEntityMap<(...)>
                    : E)[Property]>] extends [never]
                ? Property
                : never
            : [NonNullable<(E extends EntityMap
                    ? FlattenEntityMap<(...)>
                    : E)[Property]>] extends [never]
                ? never
                : NonNullable<(E extends EntityMap
                        ? FlattenEntityMap<(...)>
                        : E)[Property]> extends T[keyof Exactify<T>]
                    ? Property
                    : never]: never
    })[];
    limit?: number;
    pageKey?: E | Partial<Pick<E, keyof {
        [Property in string | number | symbol as [T[keyof Exactify<T>]] extends [never]
            ? [NonNullable<((...) extends (...)
                    ? (...)
                    : (...))[Property]>] extends [never]
                ? Property
                : never
            : [NonNullable<((...) extends (...)
                    ? (...)
                    : (...))[Property]>] extends [never]
                ? never
                : NonNullable<((...) extends (...)
                        ? (...)
                        : (...))[Property]> extends T[keyof Exactify<(...)>]
                    ? Property
                    : never]: never
    }>>;
    sortOrder?: SortOrder<E>;
}

Type Parameters

Properties

filter?: ((item: E) => unknown)

If provided, only records that pass the filter will be returned.

Type declaration

    • (item): unknown
    • Parameters

      • item: E

        Record to test.

      Returns unknown

      truthy if record should be included in result set.

hashKey?: keyof {
    [Property in string | number | symbol as [T[keyof Exactify<T>]] extends [never]
        ? [NonNullable<(E extends EntityMap
                ? FlattenEntityMap<E<(...)>>
                : E)[Property]>] extends [never]
            ? Property
            : never
        : [NonNullable<(E extends EntityMap
                ? FlattenEntityMap<E<(...)>>
                : E)[Property]>] extends [never]
            ? never
            : NonNullable<(E extends EntityMap
                    ? FlattenEntityMap<E<(...)>>
                    : E)[Property]> extends T[keyof Exactify<T>]
                ? Property
                : never]: never
}

If provided, query will only return records with matching hashValue. If not, query behaves like a DynamoDB scan.

hashValue?: T[keyof T]

If provided with hashKey, only matching records will be returned.

indexComponents?: (keyof {
    [Property in string | number | symbol as [T[keyof Exactify<T>]] extends [never]
        ? [NonNullable<(E extends EntityMap
                ? FlattenEntityMap<(...)>
                : E)[Property]>] extends [never]
            ? Property
            : never
        : [NonNullable<(E extends EntityMap
                ? FlattenEntityMap<(...)>
                : E)[Property]>] extends [never]
            ? never
            : NonNullable<(E extends EntityMap
                    ? FlattenEntityMap<(...)>
                    : E)[Property]> extends T[keyof Exactify<T>]
                ? Property
                : never]: never
})[]

If provided, returned pageKey will only contain these components. Otherwise it will contain the entire record.

limit?: number

If provided, query will only return up to limit records along with pageKey representing last record returned.

pageKey?: E | Partial<Pick<E, keyof {
    [Property in string | number | symbol as [T[keyof Exactify<T>]] extends [never]
        ? [NonNullable<((...) extends (...)
                ? (...)
                : (...))[Property]>] extends [never]
            ? Property
            : never
        : [NonNullable<((...) extends (...)
                ? (...)
                : (...))[Property]>] extends [never]
            ? never
            : NonNullable<((...) extends (...)
                    ? (...)
                    : (...))[Property]> extends T[keyof Exactify<(...)>]
                ? Property
                : never]: never
}>>

If provided, result set will begin with the record after the one represented by pageKey.

sortOrder?: SortOrder<E>

A SortOrder object specifying the sort order of the result set.