platform/test/models/car.orm.g.dart

89 lines
2.2 KiB
Dart
Raw Normal View History

2017-06-17 16:45:31 +00:00
// GENERATED CODE - DO NOT MODIFY BY HAND
// **************************************************************************
2017-06-18 04:19:05 +00:00
// Generator: PostgresORMGenerator
2017-06-17 16:45:31 +00:00
// Target: class _Car
// **************************************************************************
import 'dart:async';
2017-06-18 04:19:05 +00:00
import 'package:angel_orm/angel_orm.dart';
2017-06-17 16:45:31 +00:00
import 'package:postgres/postgres.dart';
import 'car.dart';
2017-06-18 04:19:05 +00:00
class CarQuery {
final List<String> _and = [];
2017-06-17 16:45:31 +00:00
2017-06-18 04:19:05 +00:00
final List<String> _or = [];
2017-06-17 16:45:31 +00:00
2017-06-18 04:19:05 +00:00
final List<String> _not = [];
2017-06-17 16:45:31 +00:00
2017-06-18 04:19:05 +00:00
final CarQueryWhere where = new CarQueryWhere();
2017-06-17 16:45:31 +00:00
2017-06-18 04:19:05 +00:00
void and(CarQuery other) {
var compiled = other.where.toWhereClause();
if (compiled != null) {
_and.add(compiled);
}
2017-06-17 16:45:31 +00:00
}
2017-06-18 04:19:05 +00:00
void or(CarQuery other) {
var compiled = other.where.toWhereClause();
if (compiled != null) {
_or.add(compiled);
}
2017-06-17 16:45:31 +00:00
}
2017-06-18 04:19:05 +00:00
void not(CarQuery other) {
var compiled = other.where.toWhereClause();
if (compiled != null) {
_not.add(compiled);
}
2017-06-17 16:45:31 +00:00
}
2017-06-18 04:19:05 +00:00
Stream<Car> get() {}
2017-06-17 16:45:31 +00:00
2017-06-18 04:19:05 +00:00
Future<Car> getOne() {}
2017-06-17 16:45:31 +00:00
2017-06-18 04:19:05 +00:00
Future<Car> update() {}
2017-06-17 16:45:31 +00:00
2017-06-18 04:19:05 +00:00
Future<Car> delete() {}
2017-06-17 16:45:31 +00:00
2017-06-18 04:19:05 +00:00
static Future<Car> insert(PostgreSQLConnection connection,
{String make,
String description,
bool familyFriendly,
DateTime recalledAt}) {}
2017-06-17 16:45:31 +00:00
2017-06-18 04:19:05 +00:00
static Stream<Car> getAll() => new CarQuery().get();
}
2017-06-17 16:45:31 +00:00
2017-06-18 04:19:05 +00:00
class CarQueryWhere {
final StringSqlExpressionBuilder make = new StringSqlExpressionBuilder();
final StringSqlExpressionBuilder description =
new StringSqlExpressionBuilder();
final BooleanSqlExpressionBuilder familyFriendly =
new BooleanSqlExpressionBuilder();
final DateTimeSqlExpressionBuilder recalledAt =
new DateTimeSqlExpressionBuilder('recalled_at');
String toWhereClause() {
final List<String> expressions = [];
if (make.hasValue) {
expressions.add('`make` ' + make.compile());
}
if (description.hasValue) {
expressions.add('`description` ' + description.compile());
}
if (familyFriendly.hasValue) {
expressions.add('`family_friendly` ' + familyFriendly.compile());
}
if (recalledAt.hasValue) {
expressions.add(recalledAt.compile());
}
return expressions.isEmpty ? null : ('WHERE ' + expressions.join(' AND '));
2017-06-17 16:45:31 +00:00
}
}