get<_Model extends SqliteModel> method

  1. @override
Future<List<_Model>> get<_Model extends SqliteModel>({
  1. Query? query,
  2. ModelRepository<SqliteModel>? repository,
})

Fetch one time from the SQLite database Available query providerArgs:

  • collate - a SQL COLLATE clause
  • groupBy - a SQL GROUP BY clause
  • having - a SQL HAVING clause
  • offset - a SQL OFFSET clause
  • orderBy - a SQL ORDER 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,
  );
}