get<_Model extends SqliteModel> method
Future<List<_Model> >
get<_Model extends SqliteModel>({
- Query? query,
- ModelRepository<
SqliteModel> ? repository,
Fetch one time from the SQLite database
Available query providerArgs
:
collate
- a SQLCOLLATE
clausegroupBy
- a SQLGROUP BY
clausehaving
- a SQLHAVING
clauseoffset
- a SQLOFFSET
clauseorderBy
- a SQLORDER BY
clause
Use field names not column names. For example, given a final DateTime createdAt;
field:
providerArgs: { 'orderBy': 'createdAt ASC' }
. If the column cannot be found for the first value
before a space, the value is left unchanged.
In a more complex query using multiple tables and lookups like createdAt ASC, name ASC
to produce SELECT * FROM "TableName" ORDER BY created_at ASC, name ASC;
, providerArgs
would
equal 'providerArgs': { 'orderBy': 'created_at ASC, name ASC' }
with column names defined.
As Brick manages column names, this is not recommended and should be written only when necessary.
Implementation
@override
Future<List<_Model>> get<_Model extends SqliteModel>({
query,
repository,
}) async {
final sqlQuery = QuerySqlTransformer<_Model>(
modelDictionary: modelDictionary,
query: query,
);
return await rawGet<_Model>(
sqlQuery.statement,
sqlQuery.values,
repository: repository,
);
}