Instances of this type configure and execute database commands.
Queries are used to fetch, update, insert, delete and count objects in a database. A query's InstanceType
indicates
the type of ManagedObject subclass' that this query will return as well. The InstanceType
's corresponding ManagedEntity determines
the database table and columns to work with.
var query = new Query<Employee>()
..where.salary = whereGreaterThan(50000);
var employees = await query.fetch();
Constructors
- Query([ManagedContext context ])
-
Creates a new Query.
factory - Query.forEntity(ManagedEntity entity, [ ManagedContext context ])
-
Creates a new Query without a static type.
factory
Properties
- canModifyAllInstances → bool
-
Confirms that a query has no predicate before executing it.
read / write - context → ManagedContext
-
The
ManagedContext
this query will be executed on.read-only - entity → ManagedEntity
-
The
ManagedEntity
of theInstanceType
.read-only - fetchLimit → int
-
Limits the number of objects returned from the Query.
read / write - offset → int
-
Offsets the rows returned.
read / write - predicate → QueryPredicate
-
A predicate for filtering the result or operation set.
read / write - reduce → QueryReduceOperation<InstanceType>
-
Returns a new object that can execute functions like sum, average, maximum, etc.
read-only - timeoutInSeconds → int
-
Number of seconds before a Query times out.
read / write - valueMap → Map<String, dynamic>
-
Values to be used when inserting or updating an object.
read / write - values → InstanceType
-
Values to be used when inserting or updating an object.
read / write - where → InstanceType
-
A convenience for building
predicate
in a safe way.read-only - hashCode → int
-
The hash code for this object.
read-only, inherited - runtimeType → Type
-
A representation of the runtime type of the object.
read-only, inherited
Operators
-
operator ==(
other) → bool -
The equality operator.
inherited
Methods
-
delete(
) → Future<int> -
Deletes
InstanceType
s from the underlying database. -
fetch(
) → Future<List<InstanceType>> -
Fetches
InstanceType
s from the database. -
fetchOne(
) → Future<InstanceType> -
Fetches a single
InstanceType
from the database. -
insert(
) → Future<InstanceType> -
Inserts an
InstanceType
into the underlying database. -
join<T extends ManagedObject>(
{T object(InstanceType x), ManagedSet<T> set(InstanceType x) }) → Query<T> -
Configures this instance to fetch a relationship property identified by
object
orset
. -
joinMany<T extends ManagedObject>(
ManagedSet<T> propertyIdentifier(InstanceType x)) → Query<T> -
Deprecated: see join.
@Deprecated("3.0, use join(object:set:) instead") -
joinOne<T extends ManagedObject>(
T propertyIdentifier(InstanceType x)) → Query<T> -
Deprecated: see join.
@Deprecated("3.0, use join(object:set:) instead") -
pageBy<T>(
T propertyIdentifier(InstanceType x), QuerySortOrder order, { T boundingValue }) → void -
Configures this instance to fetch a section of a larger result set.
-
returningProperties(
List propertyIdentifiers(InstanceType x)) → void -
Configures the list of properties to be fetched for
InstanceType
. -
sortBy<T>(
T propertyIdentifier(InstanceType x), QuerySortOrder order) → void -
Configures this instance to sort its results by some property and order.
-
update(
) → Future<List<InstanceType>> -
Updates
InstanceType
s in the underlying database. -
updateOne(
) → Future<InstanceType> -
Updates an
InstanceType
in the underlying database. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a non-existent method or property is accessed.
inherited -
toString(
) → String -
Returns a string representation of this object.
inherited