Query class

A database query.

The query algorithm has the following phases:

  • filter - "Find matching documents"
  • sorter - "Sort documents"
  • skip - "Skip N documents"
  • take - "Take N documents"
  • schema - "Read a specific subgraph for each result"
import 'package:database/database.dart';
import 'package:database/filter.dart';
import 'package:database/schema.dart';

final query = Query(
  filter: MapFilter({
    'name': KeywordFilter('Coffee Mug'),
    'price': RangeFilter(max:10),
  }),
  sorter: PropertySorter.descending('price'),
  skip: 0,
  take: 10,
  schema: MapSchema({
    'name': StringSchema(),
    'price': IntSchema(),
  }),
);

You can use QueryBuilder for building instances of this class.

Constructors

Query({Filter filter, Sorter sorter, Schema schema, int skip: 0, int take})
const

Properties

filter Filter
An optional filter. [...]
final
hashCode int
The hash code for this object. [...]
read-only, override
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited
schema Schema
An optional schema. [...]
final
skip int
The number of items to skip. [...]
final
sorter Sorter
An optional sorter. [...]
final
take int
The number of items to take. [...]
final

Methods

documentListFromIterable(Iterable<Snapshot> iterable, {DocumentScoring documentScoring}) List<Snapshot>
Converts an iterable into an unmodifiable result list. [...]
documentListStreamFromChunks(Stream<List<Snapshot>> stream, {DocumentScoring documentScoring, Sorter existingSorter}) Stream<List<Snapshot>>
Converts chunks into an incrementally improving result stream. [...]
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
toBuilder() QueryBuilder
toString() String
Returns a string representation of this object.
override

Operators

operator ==(dynamic other) bool
The equality operator. [...]
override

Static Methods

parse(String source, {Sorter sorter, int skip: 0, int take, Schema schema}) Query
Parses a search query using SearchQueryParser. [...]