UNPKG

@cordova-plugin-agconnect/clouddb

Version:
163 lines (162 loc) 7.45 kB
/* * Copyright (c) Huawei Technologies Co., Ltd. 2021-2021. All rights reserved. */ import { QueryObject } from "./interfaces"; export default class AGCCloudDBQuery { private readonly query; private constructor(); /** * Obtains a AGCCloudDBQuery object and specifies the object type to be queried. * The AGCCloudDBQuery object does not provide any construction method. * You can obtain an object type instance only by using the where method. * @param className Cloud DB zone name */ static where(className: string): AGCCloudDBQuery; /** * Adds a query condition where the value of a field in an entity class * is equal to a specified value. * @param fieldName Name of a field in an entity class. * @param value Specified value of the selected field. * The data type of the value must be the same as that of the selected field value. * Otherwise, an exception is thrown. */ equalTo(fieldName: string, value: any): this; /** * Adds a query condition where the value of a field in an entity class * is not equal to a specified value. * @param fieldName Name of a field in an entity class. * @param value Specified value of the selected field. * The data type of the value must be the same as that of the selected field value. * Otherwise, an exception is thrown. */ notEqualTo(fieldName: string, value: any): this; /** * Adds a query condition where the value of a field in an entity class * is greater than a specified value. * @param fieldName Name of a field in an entity class. * @param value Specified value of the selected field. * The data type of the value must be the same as that of the selected field value. * Otherwise, an exception is thrown. */ greaterThan(fieldName: string, value: any): this; /** * Adds a query condition where the value of a field in an entity class * is greater than or equal to a specified value. * @param fieldName Name of a field in an entity class. * @param value Specified value of the selected field. * The data type of the value must be the same as that of the selected field value. * Otherwise, an exception is thrown. */ greaterThanOrEqualTo(fieldName: string, value: any): this; /** * Adds a query condition where the value of a field in an entity class * is less than a specified value. * @param fieldName Name of a field in an entity class. * @param value Specified value of the selected field. * The data type of the value must be the same as that of the selected field value. * Otherwise, an exception is thrown. */ lessThan(fieldName: string, value: any): this; /** * Adds a query condition where the value of a field in an entity class * is less than or equal to a specified value. * @param fieldName Name of a field in an entity class. * @param value Specified value of the selected field. * The data type of the value must be the same as that of the selected field value. * Otherwise, an exception is thrown. */ lessThanOrEqualTo(fieldName: string, value: any): this; /** * Adds a query condition where the value of a field in an entity class * is contained in a specified array. * @param fieldName Name of a field in an entity class. * @param value Specified value of the selected field. * The data type of the value must be the same as that of the selected field value. * Otherwise, an exception is thrown. */ in(fieldName: string, value: any): this; /** * Adds a query condition where the value of a field of the string or * text type in an entity class starts with a specified substring. * @param fieldName Name of a field in an entity class. * @param value Specified value of the selected field. * The data type of the value must be the same as that of the selected field value. * Otherwise, an exception is thrown. */ beginsWith(fieldName: string, value: any): this; /** * Adds a query condition where the value of a field of the string or * text type in an entity class ends with a specified substring. * @param fieldName Name of a field in an entity class. * @param value Specified value of the selected field. * The data type of the value must be the same as that of the selected field value. * Otherwise, an exception is thrown. */ endsWith(fieldName: string, value: any): this; /** * Adds a query condition where the value of a field of the string * or text type in an entity class contains a specified substring. * @param fieldName Name of a field in an entity class. * @param value Specified value of the selected field. * The data type of the value must be the same as that of the selected field value. * Otherwise, an exception is thrown. */ contains(fieldName: string, value: any): this; /** * Adds a query condition where a field in an entity class is null. * @param fieldName Name of a field in an entity class. */ isNull(fieldName: string): this; /** * Adds a query condition where a field in an entity class is not null. * @param fieldName Name of a field in an entity class. */ isNotNull(fieldName: string): this; /** * Sorts the query results in ascending order by a specified field. * @param fieldName Name of a field in an entity class. */ orderByAsc(fieldName: string): this; /** * Sorts the query results in descending order by a specified field. * @param fieldName Name of a field in an entity class. */ orderByDesc(fieldName: string): this; /** * Add query conditions to specify the number of * data records in the returned query result set. * @param count Maximum number of data records that can be obtained. * @param offset Specifies the start position of data records. * You can specify whether to set the offset position based on the actual requirements. */ limit(count: any, offset?: number): this; /** * Set the start position of the data to be queried, and return to * the data records with the corresponding records at the start position included. * @param object The object corresponding to the start position. */ startAt(object: any): this; /** * Set the start position of the data to be queried, and return to * the data records with the corresponding records at the start position not included. * @param object The object corresponding to the start position. */ startAfter(object: any): this; /** * Set the end position of the data to be queried, and return to * the data records with the corresponding records at the end position included. * @param object The object corresponding to the start position. */ endAt(object: any): this; /** * Set the end position of the data to be queried, and return to * the data records with the corresponding records at the end position not included. * @param object The object corresponding to the start position. */ endBefore(object: any): this; /** * This method is used to build the query. * This method has to be called after query chain has been completed. */ build(): QueryObject; }