@netgrif/components-core
Version:
Netgrif Application engine frontend core Angular library
45 lines (44 loc) • 1.97 kB
TypeScript
import { BooleanOperator } from '../boolean-operator';
/**
* Abstraction of queries, so that their implementation can be replaced as needed.
*/
export declare class Query {
private _value;
private _empty;
/**
* @param _value see [value]{@link Query#value} for the specification of this attribute.
* @param _empty use `true` if the Query object represents an empty query
*/
constructor(_value: string, _empty?: boolean);
/**
* @returns an Elastic search Query string query wrapped in braces.
*
* See Elasticsearch's
* [documentation]{@link https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-query-string-query.html}
* for more information about Query string queries.
*/
get value(): string;
/**
* @returns whether this Query object represents an empty query or not
*/
get isEmpty(): boolean;
/**
* Combines multiple queries into one with the provided operator.
* @param queries queries that should be combined. Empty queries in the input array are ignored.
* @param operator operator that is used to combine the queries
* @returns a single query that is the combination of the non-empty queries in the input array. If the input array is empty an
* [empty query]{@link Query#emptyQuery} will be returned.
*/
static combineQueries(queries: Array<Query>, operator: BooleanOperator): Query;
/**
* Returns a `Query` with it's `value` set to an empty string.
*/
static emptyQuery(): Query;
/**
* @param query the query that should be compared
* @returns `true` if and only if the queries are equal.
* Returns `false` if the queries are not equal, or if attempting to tell the queries apart is too complicated.
* More specifically the method can always tell apart empty queries and if poth queries are non-empty then their values are compared.
*/
equals(query: Query): boolean;
}