Query class

Constructor for constructing query as object from understandable arguments with condition support. Query object do not call database. Query object can be converting to Map via toMap() method and used as argument to query() method of database client for sending. For debug purpose query object can be printed as String, because it has toString() method. Sample:

var query = Query(
     [
       Line('LET tag=@tag'),
       Line('FOR doc in docs'),
       LineIfThen(
          tag != null, 'FILTER doc.tags && POSITION(doc.tags, tag )'),
       Line('SORT doc.datetime'),
       LineIfThenElse(
          without_content, 'return UNSET(doc,"content")', 'return doc'),
     ],
     bindVars: [BindVarIfThen(tag != null, 'tag', tag)],
   ).toMap();
Implementers

Constructors

Query(List<QueryTextFragment> fragments, {List<BindNameValuePair>? bindVars})
Query.create(dynamic fragments, {List<BindNameValuePair>? bindVars})
Like Query() but named constructor.

Properties

bindedVars Map<String, dynamic>
Returns binded vars from query object.
no setter
bindVars List<BindNameValuePair>?
getter/setter pair
bindVarsMap Map<String, dynamic>
getter/setter pair
fragments List<QueryTextFragment>
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
queryString() String
Returns query string from Query object.
toMap() Map<String, dynamic>
Returns created query object as Map structure, which contains keys: 'query' and 'bindVars'. The 'query' key value contains a query text, queryString() method result. The 'bindVars' key value contains a structure with binded variables, bindedVars getter result.
toString() String
Human readable view of Query object. See toMap() method to get created query object as Map structure.
override

Operators

operator ==(Object other) bool
The equality operator.
inherited