Regen test models

This commit is contained in:
Tobe O 2019-08-17 18:53:27 -04:00
parent d3d16855fe
commit f4b7512c51
8 changed files with 149 additions and 21 deletions

View file

@ -318,7 +318,7 @@ class OrmGenerator extends GeneratorForAnnotation<Orm> {
var queryInstantiation = foreignQueryType var queryInstantiation = foreignQueryType
.newInstance([], {'trampoline': refer('trampoline')}); .newInstance([], {'trampoline': refer('trampoline')});
joinArgs.insert( joinArgs.insert(
0, queryInstantiation.assign(refer('_$fieldName'))); 0, refer('_$fieldName').assign(queryInstantiation));
b.addExpression(refer('leftJoin').call(joinArgs, { b.addExpression(refer('leftJoin').call(joinArgs, {
'additionalFields': 'additionalFields':

View file

@ -55,10 +55,11 @@ class BookQuery extends Query<Book, BookQueryWhere> {
trampoline ??= Set(); trampoline ??= Set();
trampoline.add(tableName); trampoline.add(tableName);
_where = BookQueryWhere(this); _where = BookQueryWhere(this);
leftJoin('authors', 'author_id', 'id', leftJoin(_author = AuthorQuery(trampoline: trampoline), 'author_id', 'id',
additionalFields: const ['id', 'created_at', 'updated_at', 'name'], additionalFields: const ['id', 'created_at', 'updated_at', 'name'],
trampoline: trampoline); 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'], additionalFields: const ['id', 'created_at', 'updated_at', 'name'],
trampoline: trampoline); trampoline: trampoline);
} }
@ -68,6 +69,10 @@ class BookQuery extends Query<Book, BookQueryWhere> {
BookQueryWhere _where; BookQueryWhere _where;
AuthorQuery _author;
AuthorQuery _partnerAuthor;
@override @override
get casts { get casts {
return {}; return {};
@ -122,6 +127,14 @@ class BookQuery extends Query<Book, BookQueryWhere> {
deserialize(List row) { deserialize(List row) {
return parseRow(row); return parseRow(row);
} }
AuthorQuery get author {
return _author;
}
AuthorQuery get partnerAuthor {
return _partnerAuthor;
}
} }
class BookQueryWhere extends QueryWhere { class BookQueryWhere extends QueryWhere {

View file

@ -64,7 +64,8 @@ class RoleQuery extends Query<Role, RoleQueryWhere> {
trampoline ??= Set(); trampoline ??= Set();
trampoline.add(tableName); trampoline.add(tableName);
_where = RoleQueryWhere(this); _where = RoleQueryWhere(this);
leftJoin(RoleUserQuery(trampoline: trampoline), 'role', 'role_role', leftJoin(
_users = RoleUserQuery(trampoline: trampoline), 'role', 'role_role',
additionalFields: const ['email', 'name', 'password'], additionalFields: const ['email', 'name', 'password'],
trampoline: trampoline); trampoline: trampoline);
} }
@ -74,6 +75,8 @@ class RoleQuery extends Query<Role, RoleQueryWhere> {
RoleQueryWhere _where; RoleQueryWhere _where;
RoleUserQuery _users;
@override @override
get casts { get casts {
return {}; return {};
@ -116,6 +119,10 @@ class RoleQuery extends Query<Role, RoleQueryWhere> {
return parseRow(row); return parseRow(row);
} }
RoleUserQuery get users {
return _users;
}
@override @override
bool canCompile(trampoline) { bool canCompile(trampoline) {
return (!(trampoline.contains('roles') && return (!(trampoline.contains('roles') &&
@ -213,9 +220,9 @@ class RoleUserQuery extends Query<RoleUser, RoleUserQueryWhere> {
trampoline ??= Set(); trampoline ??= Set();
trampoline.add(tableName); trampoline.add(tableName);
_where = RoleUserQueryWhere(this); _where = RoleUserQueryWhere(this);
leftJoin('roles', 'role_role', 'role', leftJoin(_role = RoleQuery(trampoline: trampoline), 'role_role', 'role',
additionalFields: const ['role'], trampoline: trampoline); additionalFields: const ['role'], trampoline: trampoline);
leftJoin('users', 'user_email', 'email', leftJoin(_user = UserQuery(trampoline: trampoline), 'user_email', 'email',
additionalFields: const ['email', 'name', 'password'], additionalFields: const ['email', 'name', 'password'],
trampoline: trampoline); trampoline: trampoline);
} }
@ -225,6 +232,10 @@ class RoleUserQuery extends Query<RoleUser, RoleUserQueryWhere> {
RoleUserQueryWhere _where; RoleUserQueryWhere _where;
RoleQuery _role;
UserQuery _user;
@override @override
get casts { get casts {
return {}; return {};
@ -268,6 +279,14 @@ class RoleUserQuery extends Query<RoleUser, RoleUserQueryWhere> {
deserialize(List row) { deserialize(List row) {
return parseRow(row); return parseRow(row);
} }
RoleQuery get role {
return _role;
}
UserQuery get user {
return _user;
}
} }
class RoleUserQueryWhere extends QueryWhere { class RoleUserQueryWhere extends QueryWhere {
@ -316,7 +335,8 @@ class UserQuery extends Query<User, UserQueryWhere> {
trampoline ??= Set(); trampoline ??= Set();
trampoline.add(tableName); trampoline.add(tableName);
_where = UserQueryWhere(this); _where = UserQueryWhere(this);
leftJoin(RoleUserQuery(trampoline: trampoline), 'email', 'user_email', leftJoin(
_roles = RoleUserQuery(trampoline: trampoline), 'email', 'user_email',
additionalFields: const ['role'], trampoline: trampoline); additionalFields: const ['role'], trampoline: trampoline);
} }
@ -325,6 +345,8 @@ class UserQuery extends Query<User, UserQueryWhere> {
UserQueryWhere _where; UserQueryWhere _where;
RoleUserQuery _roles;
@override @override
get casts { get casts {
return {}; return {};
@ -370,6 +392,10 @@ class UserQuery extends Query<User, UserQueryWhere> {
return parseRow(row); return parseRow(row);
} }
RoleUserQuery get roles {
return _roles;
}
@override @override
bool canCompile(trampoline) { bool canCompile(trampoline) {
return (!(trampoline.contains('users') && return (!(trampoline.contains('users') &&

View file

@ -50,7 +50,7 @@ class LegQuery extends Query<Leg, LegQueryWhere> {
trampoline ??= Set(); trampoline ??= Set();
trampoline.add(tableName); trampoline.add(tableName);
_where = LegQueryWhere(this); _where = LegQueryWhere(this);
leftJoin('feet', 'id', 'leg_id', leftJoin(_foot = FootQuery(trampoline: trampoline), 'id', 'leg_id',
additionalFields: const [ additionalFields: const [
'id', 'id',
'created_at', 'created_at',
@ -66,6 +66,8 @@ class LegQuery extends Query<Leg, LegQueryWhere> {
LegQueryWhere _where; LegQueryWhere _where;
FootQuery _foot;
@override @override
get casts { get casts {
return {}; return {};
@ -109,6 +111,10 @@ class LegQuery extends Query<Leg, LegQueryWhere> {
deserialize(List row) { deserialize(List row) {
return parseRow(row); return parseRow(row);
} }
FootQuery get foot {
return _foot;
}
} }
class LegQueryWhere extends QueryWhere { class LegQueryWhere extends QueryWhere {

View file

@ -53,7 +53,8 @@ class OrderQuery extends Query<Order, OrderQueryWhere> {
trampoline ??= Set(); trampoline ??= Set();
trampoline.add(tableName); trampoline.add(tableName);
_where = OrderQueryWhere(this); _where = OrderQueryWhere(this);
leftJoin('customers', 'customer_id', 'id', leftJoin(
_customer = CustomerQuery(trampoline: trampoline), 'customer_id', 'id',
additionalFields: const ['id', 'created_at', 'updated_at'], additionalFields: const ['id', 'created_at', 'updated_at'],
trampoline: trampoline); trampoline: trampoline);
} }
@ -63,6 +64,8 @@ class OrderQuery extends Query<Order, OrderQueryWhere> {
OrderQueryWhere _where; OrderQueryWhere _where;
CustomerQuery _customer;
@override @override
get casts { get casts {
return {}; return {};
@ -116,6 +119,10 @@ class OrderQuery extends Query<Order, OrderQueryWhere> {
deserialize(List row) { deserialize(List row) {
return parseRow(row); return parseRow(row);
} }
CustomerQuery get customer {
return _customer;
}
} }
class OrderQueryWhere extends QueryWhere { class OrderQueryWhere extends QueryWhere {

View file

@ -50,7 +50,7 @@ class TreeQuery extends Query<Tree, TreeQueryWhere> {
trampoline ??= Set(); trampoline ??= Set();
trampoline.add(tableName); trampoline.add(tableName);
_where = TreeQueryWhere(this); _where = TreeQueryWhere(this);
leftJoin(FruitQuery(trampoline: trampoline), 'id', 'tree_id', leftJoin(_fruits = FruitQuery(trampoline: trampoline), 'id', 'tree_id',
additionalFields: const [ additionalFields: const [
'id', 'id',
'created_at', 'created_at',
@ -66,6 +66,8 @@ class TreeQuery extends Query<Tree, TreeQueryWhere> {
TreeQueryWhere _where; TreeQueryWhere _where;
FruitQuery _fruits;
@override @override
get casts { get casts {
return {}; return {};
@ -112,6 +114,10 @@ class TreeQuery extends Query<Tree, TreeQueryWhere> {
return parseRow(row); return parseRow(row);
} }
FruitQuery get fruits {
return _fruits;
}
@override @override
get(QueryExecutor executor) { get(QueryExecutor executor) {
return super.get(executor).then((result) { return super.get(executor).then((result) {

View file

@ -187,9 +187,10 @@ class WeirdJoinQuery extends Query<WeirdJoin, WeirdJoinQueryWhere> {
trampoline ??= Set(); trampoline ??= Set();
trampoline.add(tableName); trampoline.add(tableName);
_where = WeirdJoinQueryWhere(this); _where = WeirdJoinQueryWhere(this);
leftJoin('unorthodoxes', 'join_name', 'name', leftJoin(_unorthodox = UnorthodoxQuery(trampoline: trampoline), 'join_name',
'name',
additionalFields: const ['name'], trampoline: trampoline); additionalFields: const ['name'], trampoline: trampoline);
leftJoin('songs', 'id', 'weird_join_id', leftJoin(_song = SongQuery(trampoline: trampoline), 'id', 'weird_join_id',
additionalFields: const [ additionalFields: const [
'id', 'id',
'created_at', 'created_at',
@ -198,9 +199,10 @@ class WeirdJoinQuery extends Query<WeirdJoin, WeirdJoinQueryWhere> {
'title' 'title'
], ],
trampoline: trampoline); trampoline: trampoline);
leftJoin(NumbaQuery(trampoline: trampoline), 'id', 'parent', leftJoin(_numbas = NumbaQuery(trampoline: trampoline), 'id', 'parent',
additionalFields: const ['i', 'parent'], trampoline: trampoline); 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); additionalFields: const ['bar'], trampoline: trampoline);
} }
@ -209,6 +211,14 @@ class WeirdJoinQuery extends Query<WeirdJoin, WeirdJoinQueryWhere> {
WeirdJoinQueryWhere _where; WeirdJoinQueryWhere _where;
UnorthodoxQuery _unorthodox;
SongQuery _song;
NumbaQuery _numbas;
FooPivotQuery _foos;
@override @override
get casts { get casts {
return {}; return {};
@ -265,6 +275,22 @@ class WeirdJoinQuery extends Query<WeirdJoin, WeirdJoinQueryWhere> {
return parseRow(row); return parseRow(row);
} }
UnorthodoxQuery get unorthodox {
return _unorthodox;
}
SongQuery get song {
return _song;
}
NumbaQuery get numbas {
return _numbas;
}
FooPivotQuery get foos {
return _foos;
}
@override @override
bool canCompile(trampoline) { bool canCompile(trampoline) {
return (!(trampoline.contains('weird_joins') && return (!(trampoline.contains('weird_joins') &&
@ -579,7 +605,8 @@ class FooQuery extends Query<Foo, FooQueryWhere> {
trampoline ??= Set(); trampoline ??= Set();
trampoline.add(tableName); trampoline.add(tableName);
_where = FooQueryWhere(this); _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); additionalFields: const ['id', 'join_name'], trampoline: trampoline);
} }
@ -588,6 +615,8 @@ class FooQuery extends Query<Foo, FooQueryWhere> {
FooQueryWhere _where; FooQueryWhere _where;
FooPivotQuery _weirdJoins;
@override @override
get casts { get casts {
return {}; return {};
@ -630,6 +659,10 @@ class FooQuery extends Query<Foo, FooQueryWhere> {
return parseRow(row); return parseRow(row);
} }
FooPivotQuery get weirdJoins {
return _weirdJoins;
}
@override @override
bool canCompile(trampoline) { bool canCompile(trampoline) {
return (!(trampoline.contains('foos') && return (!(trampoline.contains('foos') &&
@ -727,9 +760,10 @@ class FooPivotQuery extends Query<FooPivot, FooPivotQueryWhere> {
trampoline ??= Set(); trampoline ??= Set();
trampoline.add(tableName); trampoline.add(tableName);
_where = FooPivotQueryWhere(this); _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); 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); additionalFields: const ['bar'], trampoline: trampoline);
} }
@ -738,6 +772,10 @@ class FooPivotQuery extends Query<FooPivot, FooPivotQueryWhere> {
FooPivotQueryWhere _where; FooPivotQueryWhere _where;
WeirdJoinQuery _weirdJoin;
FooQuery _foo;
@override @override
get casts { get casts {
return {}; return {};
@ -781,6 +819,14 @@ class FooPivotQuery extends Query<FooPivot, FooPivotQueryWhere> {
deserialize(List row) { deserialize(List row) {
return parseRow(row); return parseRow(row);
} }
WeirdJoinQuery get weirdJoin {
return _weirdJoin;
}
FooQuery get foo {
return _foo;
}
} }
class FooPivotQueryWhere extends QueryWhere { class FooPivotQueryWhere extends QueryWhere {

View file

@ -66,7 +66,7 @@ class UserQuery extends Query<User, UserQueryWhere> {
trampoline ??= Set(); trampoline ??= Set();
trampoline.add(tableName); trampoline.add(tableName);
_where = UserQueryWhere(this); _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'], additionalFields: const ['id', 'created_at', 'updated_at', 'name'],
trampoline: trampoline); trampoline: trampoline);
} }
@ -76,6 +76,8 @@ class UserQuery extends Query<User, UserQueryWhere> {
UserQueryWhere _where; UserQueryWhere _where;
RoleUserQuery _roles;
@override @override
get casts { get casts {
return {}; return {};
@ -131,6 +133,10 @@ class UserQuery extends Query<User, UserQueryWhere> {
return parseRow(row); return parseRow(row);
} }
RoleUserQuery get roles {
return _roles;
}
@override @override
bool canCompile(trampoline) { bool canCompile(trampoline) {
return (!(trampoline.contains('users') && return (!(trampoline.contains('users') &&
@ -272,10 +278,10 @@ class RoleUserQuery extends Query<RoleUser, RoleUserQueryWhere> {
trampoline ??= Set(); trampoline ??= Set();
trampoline.add(tableName); trampoline.add(tableName);
_where = RoleUserQueryWhere(this); _where = RoleUserQueryWhere(this);
leftJoin('roles', 'role_id', 'id', leftJoin(_role = RoleQuery(trampoline: trampoline), 'role_id', 'id',
additionalFields: const ['id', 'created_at', 'updated_at', 'name'], additionalFields: const ['id', 'created_at', 'updated_at', 'name'],
trampoline: trampoline); trampoline: trampoline);
leftJoin('users', 'user_id', 'id', leftJoin(_user = UserQuery(trampoline: trampoline), 'user_id', 'id',
additionalFields: const [ additionalFields: const [
'id', 'id',
'created_at', 'created_at',
@ -292,6 +298,10 @@ class RoleUserQuery extends Query<RoleUser, RoleUserQueryWhere> {
RoleUserQueryWhere _where; RoleUserQueryWhere _where;
RoleQuery _role;
UserQuery _user;
@override @override
get casts { get casts {
return {}; return {};
@ -335,6 +345,14 @@ class RoleUserQuery extends Query<RoleUser, RoleUserQueryWhere> {
deserialize(List row) { deserialize(List row) {
return parseRow(row); return parseRow(row);
} }
RoleQuery get role {
return _role;
}
UserQuery get user {
return _user;
}
} }
class RoleUserQueryWhere extends QueryWhere { class RoleUserQueryWhere extends QueryWhere {
@ -383,7 +401,7 @@ class RoleQuery extends Query<Role, RoleQueryWhere> {
trampoline ??= Set(); trampoline ??= Set();
trampoline.add(tableName); trampoline.add(tableName);
_where = RoleQueryWhere(this); _where = RoleQueryWhere(this);
leftJoin(RoleUserQuery(trampoline: trampoline), 'id', 'role_id', leftJoin(_users = RoleUserQuery(trampoline: trampoline), 'id', 'role_id',
additionalFields: const [ additionalFields: const [
'id', 'id',
'created_at', 'created_at',
@ -400,6 +418,8 @@ class RoleQuery extends Query<Role, RoleQueryWhere> {
RoleQueryWhere _where; RoleQueryWhere _where;
RoleUserQuery _users;
@override @override
get casts { get casts {
return {}; return {};
@ -446,6 +466,10 @@ class RoleQuery extends Query<Role, RoleQueryWhere> {
return parseRow(row); return parseRow(row);
} }
RoleUserQuery get users {
return _users;
}
@override @override
bool canCompile(trampoline) { bool canCompile(trampoline) {
return (!(trampoline.contains('roles') && return (!(trampoline.contains('roles') &&