QueryScopes<T> mixin

Mixin that enables query scopes on models with helper utilities

Superclass constraints

Properties

exists bool
getter/setter pairinherited
hashCode int
The hash code for this object.
no setterinherited
id int?
getter/setter pairinherited
primaryKey String
no setterinherited
query QueryBuilderInterface<T>
Get a new query builder for the model's table.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
table String
no setterinherited
tableName String
no setterinherited

Methods

all() Future<List<T>>
Get all models.
inherited
applyScopes(List<QueryBuilderInterface<T> Function(QueryBuilderInterface<T>)> scopeFunctions) QueryBuilderInterface<T>
Apply multiple scope functions in sequence
decrement(String column, [int amount = 1]) Future<void>
Decrement a column's value.
inherited
delete() Future<bool>
Delete the model from the database.
inherited
find(dynamic id) Future<T?>
Find a model by its primary key.
inherited
findOrFail(dynamic id) Future<T>
Find a model by its primary key or throw an exception.
inherited
fresh([List<String> withRelations = const []]) Future<T?>
Get a fresh instance of the model from the database.
inherited
getKey() → dynamic
inherited
increment(String column, [int amount = 1]) Future<void>
Increment a column's value.
inherited
newFactory(Map<String, dynamic> data) → T
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
refresh() Future<void>
Refresh the model from the database.
inherited
save() Future<bool>
Save the model to the database.
inherited
toString() String
A string representation of this object.
inherited
unless(bool condition, QueryBuilderInterface<T> currentQuery, QueryBuilderInterface<T> scopeFunction(QueryBuilderInterface<T>)) QueryBuilderInterface<T>
Apply a scope unless a condition is met
update(Map<String, dynamic> attributes) Future<bool>
Update the model in the database.
inherited
when(bool condition, QueryBuilderInterface<T> currentQuery, QueryBuilderInterface<T> scopeFunction(QueryBuilderInterface<T>)) QueryBuilderInterface<T>
Conditionally apply a scope based on a condition

Operators

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