FB4D Reference TQueryParamsHelper - SchneiderInfosystems/FB4D GitHub Wiki
Class Helper TQueryParamsHelper
This class helper extends TQueryParams (TDictionary<string, TStringDynArray>) and can be used for both databases (RT-DB and Firestore). It helps to setup the QueryParams.
Constructor
This constructor supports fluent interface design. You can pass a previously created TQueryParams or nil and always get back a valid TQueryParams.
class function CreateQueryParams(CheckThisInstanceFirst: TQueryParams =
nil): TQueryParams;
OrderBy
function AddOrderBy(const FieldName: string): TQueryParams;
function AddOrderByType(const TypeName: string): TQueryParams;
Limits
function AddLimitToFirst(LimitToFirst: integer): TQueryParams;
function AddLimitToLast(LimitToLast: integer): TQueryParams;
OrderBy and Filter for equal condition
function AddOrderByAndEqualTo(const FieldName,
FilterValue: string): TQueryParams; overload;
function AddOrderByAndEqualTo(const FieldName: string;
FilterValue: integer): TQueryParams; overload;
function AddOrderByAndEqualTo(const FieldName: string;
FilterValue: extended): TQueryParams; overload;
Paging support
function AddPageSize(PageSize: integer): TQueryParams;
function AddPageToken(const PageToken: string): TQueryParams;
Reference to a Read Transaction (Firestore only)
function AddTransaction(
Transaction: TFirestoreReadTransaction): TQueryParams;
Examples
Application for Realtime Database:
TQueryParams.CreateQueryParams.AddOrderBy(ColumnName: string).AddLimitToFirst(NumberOfResults: integer);
Application for Firestore Cloud Database:
TQueryParams.CreateQueryParams.AddTransaction(ReadTransaction: TFirestoreReadTransaction).AddPageSize(NumberOfResults: integer);