Open daniloadorno opened 4 years ago
Sadly we don't allow completely dynamic queries like yours. Your use-case might be an exception but generally this is also not a good idea because of sql-injections and other issues.
It might be possible to use @rawQuery
/isRaw
for this once it is implemented (see #315), but you will miss auto-updated Streams and static type validation, which can only be done on queries which are known at compile time.
is that in some cases it is necessary to take only one field, in other cases it is necessary to make a count, in other cases it is necessary to do sum, the dynamic query would greatly decrease the creation of methods.
I made this implementation to give me this power:
ex:
Future<List
how to do?
@Query(sql) Future findBySql(String sql);
in .g.dart
@override Future findBySql(String sql) async {
return _queryAdapter.query(sql, mapper: _tMapper);
}