generateView method
Implementation
String generateView() {
final Map views = local2dart['view'] ?? {};
StringBuffer bufferView = StringBuffer();
views.forEach((viewName, view) {
String rawQuery = getRawQuery(
distinct: view['disticnt'] ?? false,
column: view['column'],
from: view['from'],
join: view['join'],
where: view['where'],
isWhereArgs: false,
orderBy: view['order_by'],
limit: view['limit'],
offset: view['offset'],
groupBy: view['group_by'],
having: view['having'],
);
final createView = view['create_if_not_exists'] ?? true
? 'CREATE VIEW IF NOT EXISTS'
: 'CREATE VIEW';
final rawView =
'$createView ${viewName.toString().snakeCase}_view AS $rawQuery';
bufferView.writeln("await db.execute('$rawView');");
});
return bufferView.toString();
}