Regen test models
This commit is contained in:
parent
d3d16855fe
commit
f4b7512c51
8 changed files with 149 additions and 21 deletions
|
@ -318,7 +318,7 @@ class OrmGenerator extends GeneratorForAnnotation<Orm> {
|
|||
var queryInstantiation = foreignQueryType
|
||||
.newInstance([], {'trampoline': refer('trampoline')});
|
||||
joinArgs.insert(
|
||||
0, queryInstantiation.assign(refer('_$fieldName')));
|
||||
0, refer('_$fieldName').assign(queryInstantiation));
|
||||
|
||||
b.addExpression(refer('leftJoin').call(joinArgs, {
|
||||
'additionalFields':
|
||||
|
|
|
@ -55,10 +55,11 @@ class BookQuery extends Query<Book, BookQueryWhere> {
|
|||
trampoline ??= Set();
|
||||
trampoline.add(tableName);
|
||||
_where = BookQueryWhere(this);
|
||||
leftJoin('authors', 'author_id', 'id',
|
||||
leftJoin(_author = AuthorQuery(trampoline: trampoline), 'author_id', 'id',
|
||||
additionalFields: const ['id', 'created_at', 'updated_at', 'name'],
|
||||
trampoline: trampoline);
|
||||
leftJoin('authors', 'partner_author_id', 'id',
|
||||
leftJoin(_partnerAuthor = AuthorQuery(trampoline: trampoline),
|
||||
'partner_author_id', 'id',
|
||||
additionalFields: const ['id', 'created_at', 'updated_at', 'name'],
|
||||
trampoline: trampoline);
|
||||
}
|
||||
|
@ -68,6 +69,10 @@ class BookQuery extends Query<Book, BookQueryWhere> {
|
|||
|
||||
BookQueryWhere _where;
|
||||
|
||||
AuthorQuery _author;
|
||||
|
||||
AuthorQuery _partnerAuthor;
|
||||
|
||||
@override
|
||||
get casts {
|
||||
return {};
|
||||
|
@ -122,6 +127,14 @@ class BookQuery extends Query<Book, BookQueryWhere> {
|
|||
deserialize(List row) {
|
||||
return parseRow(row);
|
||||
}
|
||||
|
||||
AuthorQuery get author {
|
||||
return _author;
|
||||
}
|
||||
|
||||
AuthorQuery get partnerAuthor {
|
||||
return _partnerAuthor;
|
||||
}
|
||||
}
|
||||
|
||||
class BookQueryWhere extends QueryWhere {
|
||||
|
|
|
@ -64,7 +64,8 @@ class RoleQuery extends Query<Role, RoleQueryWhere> {
|
|||
trampoline ??= Set();
|
||||
trampoline.add(tableName);
|
||||
_where = RoleQueryWhere(this);
|
||||
leftJoin(RoleUserQuery(trampoline: trampoline), 'role', 'role_role',
|
||||
leftJoin(
|
||||
_users = RoleUserQuery(trampoline: trampoline), 'role', 'role_role',
|
||||
additionalFields: const ['email', 'name', 'password'],
|
||||
trampoline: trampoline);
|
||||
}
|
||||
|
@ -74,6 +75,8 @@ class RoleQuery extends Query<Role, RoleQueryWhere> {
|
|||
|
||||
RoleQueryWhere _where;
|
||||
|
||||
RoleUserQuery _users;
|
||||
|
||||
@override
|
||||
get casts {
|
||||
return {};
|
||||
|
@ -116,6 +119,10 @@ class RoleQuery extends Query<Role, RoleQueryWhere> {
|
|||
return parseRow(row);
|
||||
}
|
||||
|
||||
RoleUserQuery get users {
|
||||
return _users;
|
||||
}
|
||||
|
||||
@override
|
||||
bool canCompile(trampoline) {
|
||||
return (!(trampoline.contains('roles') &&
|
||||
|
@ -213,9 +220,9 @@ class RoleUserQuery extends Query<RoleUser, RoleUserQueryWhere> {
|
|||
trampoline ??= Set();
|
||||
trampoline.add(tableName);
|
||||
_where = RoleUserQueryWhere(this);
|
||||
leftJoin('roles', 'role_role', 'role',
|
||||
leftJoin(_role = RoleQuery(trampoline: trampoline), 'role_role', 'role',
|
||||
additionalFields: const ['role'], trampoline: trampoline);
|
||||
leftJoin('users', 'user_email', 'email',
|
||||
leftJoin(_user = UserQuery(trampoline: trampoline), 'user_email', 'email',
|
||||
additionalFields: const ['email', 'name', 'password'],
|
||||
trampoline: trampoline);
|
||||
}
|
||||
|
@ -225,6 +232,10 @@ class RoleUserQuery extends Query<RoleUser, RoleUserQueryWhere> {
|
|||
|
||||
RoleUserQueryWhere _where;
|
||||
|
||||
RoleQuery _role;
|
||||
|
||||
UserQuery _user;
|
||||
|
||||
@override
|
||||
get casts {
|
||||
return {};
|
||||
|
@ -268,6 +279,14 @@ class RoleUserQuery extends Query<RoleUser, RoleUserQueryWhere> {
|
|||
deserialize(List row) {
|
||||
return parseRow(row);
|
||||
}
|
||||
|
||||
RoleQuery get role {
|
||||
return _role;
|
||||
}
|
||||
|
||||
UserQuery get user {
|
||||
return _user;
|
||||
}
|
||||
}
|
||||
|
||||
class RoleUserQueryWhere extends QueryWhere {
|
||||
|
@ -316,7 +335,8 @@ class UserQuery extends Query<User, UserQueryWhere> {
|
|||
trampoline ??= Set();
|
||||
trampoline.add(tableName);
|
||||
_where = UserQueryWhere(this);
|
||||
leftJoin(RoleUserQuery(trampoline: trampoline), 'email', 'user_email',
|
||||
leftJoin(
|
||||
_roles = RoleUserQuery(trampoline: trampoline), 'email', 'user_email',
|
||||
additionalFields: const ['role'], trampoline: trampoline);
|
||||
}
|
||||
|
||||
|
@ -325,6 +345,8 @@ class UserQuery extends Query<User, UserQueryWhere> {
|
|||
|
||||
UserQueryWhere _where;
|
||||
|
||||
RoleUserQuery _roles;
|
||||
|
||||
@override
|
||||
get casts {
|
||||
return {};
|
||||
|
@ -370,6 +392,10 @@ class UserQuery extends Query<User, UserQueryWhere> {
|
|||
return parseRow(row);
|
||||
}
|
||||
|
||||
RoleUserQuery get roles {
|
||||
return _roles;
|
||||
}
|
||||
|
||||
@override
|
||||
bool canCompile(trampoline) {
|
||||
return (!(trampoline.contains('users') &&
|
||||
|
|
|
@ -50,7 +50,7 @@ class LegQuery extends Query<Leg, LegQueryWhere> {
|
|||
trampoline ??= Set();
|
||||
trampoline.add(tableName);
|
||||
_where = LegQueryWhere(this);
|
||||
leftJoin('feet', 'id', 'leg_id',
|
||||
leftJoin(_foot = FootQuery(trampoline: trampoline), 'id', 'leg_id',
|
||||
additionalFields: const [
|
||||
'id',
|
||||
'created_at',
|
||||
|
@ -66,6 +66,8 @@ class LegQuery extends Query<Leg, LegQueryWhere> {
|
|||
|
||||
LegQueryWhere _where;
|
||||
|
||||
FootQuery _foot;
|
||||
|
||||
@override
|
||||
get casts {
|
||||
return {};
|
||||
|
@ -109,6 +111,10 @@ class LegQuery extends Query<Leg, LegQueryWhere> {
|
|||
deserialize(List row) {
|
||||
return parseRow(row);
|
||||
}
|
||||
|
||||
FootQuery get foot {
|
||||
return _foot;
|
||||
}
|
||||
}
|
||||
|
||||
class LegQueryWhere extends QueryWhere {
|
||||
|
|
|
@ -53,7 +53,8 @@ class OrderQuery extends Query<Order, OrderQueryWhere> {
|
|||
trampoline ??= Set();
|
||||
trampoline.add(tableName);
|
||||
_where = OrderQueryWhere(this);
|
||||
leftJoin('customers', 'customer_id', 'id',
|
||||
leftJoin(
|
||||
_customer = CustomerQuery(trampoline: trampoline), 'customer_id', 'id',
|
||||
additionalFields: const ['id', 'created_at', 'updated_at'],
|
||||
trampoline: trampoline);
|
||||
}
|
||||
|
@ -63,6 +64,8 @@ class OrderQuery extends Query<Order, OrderQueryWhere> {
|
|||
|
||||
OrderQueryWhere _where;
|
||||
|
||||
CustomerQuery _customer;
|
||||
|
||||
@override
|
||||
get casts {
|
||||
return {};
|
||||
|
@ -116,6 +119,10 @@ class OrderQuery extends Query<Order, OrderQueryWhere> {
|
|||
deserialize(List row) {
|
||||
return parseRow(row);
|
||||
}
|
||||
|
||||
CustomerQuery get customer {
|
||||
return _customer;
|
||||
}
|
||||
}
|
||||
|
||||
class OrderQueryWhere extends QueryWhere {
|
||||
|
|
|
@ -50,7 +50,7 @@ class TreeQuery extends Query<Tree, TreeQueryWhere> {
|
|||
trampoline ??= Set();
|
||||
trampoline.add(tableName);
|
||||
_where = TreeQueryWhere(this);
|
||||
leftJoin(FruitQuery(trampoline: trampoline), 'id', 'tree_id',
|
||||
leftJoin(_fruits = FruitQuery(trampoline: trampoline), 'id', 'tree_id',
|
||||
additionalFields: const [
|
||||
'id',
|
||||
'created_at',
|
||||
|
@ -66,6 +66,8 @@ class TreeQuery extends Query<Tree, TreeQueryWhere> {
|
|||
|
||||
TreeQueryWhere _where;
|
||||
|
||||
FruitQuery _fruits;
|
||||
|
||||
@override
|
||||
get casts {
|
||||
return {};
|
||||
|
@ -112,6 +114,10 @@ class TreeQuery extends Query<Tree, TreeQueryWhere> {
|
|||
return parseRow(row);
|
||||
}
|
||||
|
||||
FruitQuery get fruits {
|
||||
return _fruits;
|
||||
}
|
||||
|
||||
@override
|
||||
get(QueryExecutor executor) {
|
||||
return super.get(executor).then((result) {
|
||||
|
|
|
@ -187,9 +187,10 @@ class WeirdJoinQuery extends Query<WeirdJoin, WeirdJoinQueryWhere> {
|
|||
trampoline ??= Set();
|
||||
trampoline.add(tableName);
|
||||
_where = WeirdJoinQueryWhere(this);
|
||||
leftJoin('unorthodoxes', 'join_name', 'name',
|
||||
leftJoin(_unorthodox = UnorthodoxQuery(trampoline: trampoline), 'join_name',
|
||||
'name',
|
||||
additionalFields: const ['name'], trampoline: trampoline);
|
||||
leftJoin('songs', 'id', 'weird_join_id',
|
||||
leftJoin(_song = SongQuery(trampoline: trampoline), 'id', 'weird_join_id',
|
||||
additionalFields: const [
|
||||
'id',
|
||||
'created_at',
|
||||
|
@ -198,9 +199,10 @@ class WeirdJoinQuery extends Query<WeirdJoin, WeirdJoinQueryWhere> {
|
|||
'title'
|
||||
],
|
||||
trampoline: trampoline);
|
||||
leftJoin(NumbaQuery(trampoline: trampoline), 'id', 'parent',
|
||||
leftJoin(_numbas = NumbaQuery(trampoline: trampoline), 'id', 'parent',
|
||||
additionalFields: const ['i', 'parent'], trampoline: trampoline);
|
||||
leftJoin(FooPivotQuery(trampoline: trampoline), 'id', 'weird_join_id',
|
||||
leftJoin(
|
||||
_foos = FooPivotQuery(trampoline: trampoline), 'id', 'weird_join_id',
|
||||
additionalFields: const ['bar'], trampoline: trampoline);
|
||||
}
|
||||
|
||||
|
@ -209,6 +211,14 @@ class WeirdJoinQuery extends Query<WeirdJoin, WeirdJoinQueryWhere> {
|
|||
|
||||
WeirdJoinQueryWhere _where;
|
||||
|
||||
UnorthodoxQuery _unorthodox;
|
||||
|
||||
SongQuery _song;
|
||||
|
||||
NumbaQuery _numbas;
|
||||
|
||||
FooPivotQuery _foos;
|
||||
|
||||
@override
|
||||
get casts {
|
||||
return {};
|
||||
|
@ -265,6 +275,22 @@ class WeirdJoinQuery extends Query<WeirdJoin, WeirdJoinQueryWhere> {
|
|||
return parseRow(row);
|
||||
}
|
||||
|
||||
UnorthodoxQuery get unorthodox {
|
||||
return _unorthodox;
|
||||
}
|
||||
|
||||
SongQuery get song {
|
||||
return _song;
|
||||
}
|
||||
|
||||
NumbaQuery get numbas {
|
||||
return _numbas;
|
||||
}
|
||||
|
||||
FooPivotQuery get foos {
|
||||
return _foos;
|
||||
}
|
||||
|
||||
@override
|
||||
bool canCompile(trampoline) {
|
||||
return (!(trampoline.contains('weird_joins') &&
|
||||
|
@ -579,7 +605,8 @@ class FooQuery extends Query<Foo, FooQueryWhere> {
|
|||
trampoline ??= Set();
|
||||
trampoline.add(tableName);
|
||||
_where = FooQueryWhere(this);
|
||||
leftJoin(FooPivotQuery(trampoline: trampoline), 'bar', 'foo_bar',
|
||||
leftJoin(
|
||||
_weirdJoins = FooPivotQuery(trampoline: trampoline), 'bar', 'foo_bar',
|
||||
additionalFields: const ['id', 'join_name'], trampoline: trampoline);
|
||||
}
|
||||
|
||||
|
@ -588,6 +615,8 @@ class FooQuery extends Query<Foo, FooQueryWhere> {
|
|||
|
||||
FooQueryWhere _where;
|
||||
|
||||
FooPivotQuery _weirdJoins;
|
||||
|
||||
@override
|
||||
get casts {
|
||||
return {};
|
||||
|
@ -630,6 +659,10 @@ class FooQuery extends Query<Foo, FooQueryWhere> {
|
|||
return parseRow(row);
|
||||
}
|
||||
|
||||
FooPivotQuery get weirdJoins {
|
||||
return _weirdJoins;
|
||||
}
|
||||
|
||||
@override
|
||||
bool canCompile(trampoline) {
|
||||
return (!(trampoline.contains('foos') &&
|
||||
|
@ -727,9 +760,10 @@ class FooPivotQuery extends Query<FooPivot, FooPivotQueryWhere> {
|
|||
trampoline ??= Set();
|
||||
trampoline.add(tableName);
|
||||
_where = FooPivotQueryWhere(this);
|
||||
leftJoin('weird_joins', 'weird_join_id', 'id',
|
||||
leftJoin(_weirdJoin = WeirdJoinQuery(trampoline: trampoline),
|
||||
'weird_join_id', 'id',
|
||||
additionalFields: const ['id', 'join_name'], trampoline: trampoline);
|
||||
leftJoin('foos', 'foo_bar', 'bar',
|
||||
leftJoin(_foo = FooQuery(trampoline: trampoline), 'foo_bar', 'bar',
|
||||
additionalFields: const ['bar'], trampoline: trampoline);
|
||||
}
|
||||
|
||||
|
@ -738,6 +772,10 @@ class FooPivotQuery extends Query<FooPivot, FooPivotQueryWhere> {
|
|||
|
||||
FooPivotQueryWhere _where;
|
||||
|
||||
WeirdJoinQuery _weirdJoin;
|
||||
|
||||
FooQuery _foo;
|
||||
|
||||
@override
|
||||
get casts {
|
||||
return {};
|
||||
|
@ -781,6 +819,14 @@ class FooPivotQuery extends Query<FooPivot, FooPivotQueryWhere> {
|
|||
deserialize(List row) {
|
||||
return parseRow(row);
|
||||
}
|
||||
|
||||
WeirdJoinQuery get weirdJoin {
|
||||
return _weirdJoin;
|
||||
}
|
||||
|
||||
FooQuery get foo {
|
||||
return _foo;
|
||||
}
|
||||
}
|
||||
|
||||
class FooPivotQueryWhere extends QueryWhere {
|
||||
|
|
|
@ -66,7 +66,7 @@ class UserQuery extends Query<User, UserQueryWhere> {
|
|||
trampoline ??= Set();
|
||||
trampoline.add(tableName);
|
||||
_where = UserQueryWhere(this);
|
||||
leftJoin(RoleUserQuery(trampoline: trampoline), 'id', 'user_id',
|
||||
leftJoin(_roles = RoleUserQuery(trampoline: trampoline), 'id', 'user_id',
|
||||
additionalFields: const ['id', 'created_at', 'updated_at', 'name'],
|
||||
trampoline: trampoline);
|
||||
}
|
||||
|
@ -76,6 +76,8 @@ class UserQuery extends Query<User, UserQueryWhere> {
|
|||
|
||||
UserQueryWhere _where;
|
||||
|
||||
RoleUserQuery _roles;
|
||||
|
||||
@override
|
||||
get casts {
|
||||
return {};
|
||||
|
@ -131,6 +133,10 @@ class UserQuery extends Query<User, UserQueryWhere> {
|
|||
return parseRow(row);
|
||||
}
|
||||
|
||||
RoleUserQuery get roles {
|
||||
return _roles;
|
||||
}
|
||||
|
||||
@override
|
||||
bool canCompile(trampoline) {
|
||||
return (!(trampoline.contains('users') &&
|
||||
|
@ -272,10 +278,10 @@ class RoleUserQuery extends Query<RoleUser, RoleUserQueryWhere> {
|
|||
trampoline ??= Set();
|
||||
trampoline.add(tableName);
|
||||
_where = RoleUserQueryWhere(this);
|
||||
leftJoin('roles', 'role_id', 'id',
|
||||
leftJoin(_role = RoleQuery(trampoline: trampoline), 'role_id', 'id',
|
||||
additionalFields: const ['id', 'created_at', 'updated_at', 'name'],
|
||||
trampoline: trampoline);
|
||||
leftJoin('users', 'user_id', 'id',
|
||||
leftJoin(_user = UserQuery(trampoline: trampoline), 'user_id', 'id',
|
||||
additionalFields: const [
|
||||
'id',
|
||||
'created_at',
|
||||
|
@ -292,6 +298,10 @@ class RoleUserQuery extends Query<RoleUser, RoleUserQueryWhere> {
|
|||
|
||||
RoleUserQueryWhere _where;
|
||||
|
||||
RoleQuery _role;
|
||||
|
||||
UserQuery _user;
|
||||
|
||||
@override
|
||||
get casts {
|
||||
return {};
|
||||
|
@ -335,6 +345,14 @@ class RoleUserQuery extends Query<RoleUser, RoleUserQueryWhere> {
|
|||
deserialize(List row) {
|
||||
return parseRow(row);
|
||||
}
|
||||
|
||||
RoleQuery get role {
|
||||
return _role;
|
||||
}
|
||||
|
||||
UserQuery get user {
|
||||
return _user;
|
||||
}
|
||||
}
|
||||
|
||||
class RoleUserQueryWhere extends QueryWhere {
|
||||
|
@ -383,7 +401,7 @@ class RoleQuery extends Query<Role, RoleQueryWhere> {
|
|||
trampoline ??= Set();
|
||||
trampoline.add(tableName);
|
||||
_where = RoleQueryWhere(this);
|
||||
leftJoin(RoleUserQuery(trampoline: trampoline), 'id', 'role_id',
|
||||
leftJoin(_users = RoleUserQuery(trampoline: trampoline), 'id', 'role_id',
|
||||
additionalFields: const [
|
||||
'id',
|
||||
'created_at',
|
||||
|
@ -400,6 +418,8 @@ class RoleQuery extends Query<Role, RoleQueryWhere> {
|
|||
|
||||
RoleQueryWhere _where;
|
||||
|
||||
RoleUserQuery _users;
|
||||
|
||||
@override
|
||||
get casts {
|
||||
return {};
|
||||
|
@ -446,6 +466,10 @@ class RoleQuery extends Query<Role, RoleQueryWhere> {
|
|||
return parseRow(row);
|
||||
}
|
||||
|
||||
RoleUserQuery get users {
|
||||
return _users;
|
||||
}
|
||||
|
||||
@override
|
||||
bool canCompile(trampoline) {
|
||||
return (!(trampoline.contains('roles') &&
|
||||
|
|
Loading…
Reference in a new issue