un-private

This commit is contained in:
Tobe O 2018-10-22 18:51:44 -04:00
parent 4b374597eb
commit 6f33f28402
17 changed files with 63 additions and 26 deletions

View file

@ -100,7 +100,7 @@ class OrmGenerator extends GeneratorForAnnotation<Orm> {
b b
..name = 'postgreSql' ..name = 'postgreSql'
..factory = true ..factory = true
..redirect = refer('_PostgreSql${rc.pascalCase}OrmImpl') ..redirect = refer('PostgreSql${rc.pascalCase}Orm')
..requiredParameters.add(new Parameter((b) { ..requiredParameters.add(new Parameter((b) {
b b
..name = 'connection' ..name = 'connection'

View file

@ -51,7 +51,7 @@ class PostgreSqlOrmGenerator extends GeneratorForAnnotation<Orm> {
return new Class((clazz) { return new Class((clazz) {
var rc = ctx.buildContext.modelClassNameRecase; var rc = ctx.buildContext.modelClassNameRecase;
clazz clazz
..name = '_PostgreSql${rc.pascalCase}OrmImpl' ..name = 'PostgreSql${rc.pascalCase}Orm'
..implements.add(refer('${rc.pascalCase}Orm')) ..implements.add(refer('${rc.pascalCase}Orm'))
// final PostgreSQLConnection connection; // final PostgreSQLConnection connection;
@ -74,7 +74,17 @@ class PostgreSqlOrmGenerator extends GeneratorForAnnotation<Orm> {
..methods.add(buildDeleteById(ctx)) ..methods.add(buildDeleteById(ctx))
..methods.add(buildGetAll(ctx)) ..methods.add(buildGetAll(ctx))
..methods.add(buildCreate(ctx)) ..methods.add(buildCreate(ctx))
..methods.add(buildUpdate(ctx)); ..methods.add(buildUpdate(ctx))
..methods.add(buildQuery(ctx));
});
}
Method buildQuery(OrmBuildContext ctx) {
return new Method((m) {
m
..name = 'query'
..returns = refer('${ctx.buildContext.modelClassName}Query')
..body = new Block((b) => b.addExpression(literalNull.returned));
}); });
} }

View file

@ -11,7 +11,7 @@ part 'author.postgresql.orm.g.dart';
abstract class AuthorOrm { abstract class AuthorOrm {
factory AuthorOrm.postgreSql(PostgreSQLConnection connection) = factory AuthorOrm.postgreSql(PostgreSQLConnection connection) =
_PostgreSqlAuthorOrmImpl; PostgreSqlAuthorOrm;
Future<List<Author>> getAll(); Future<List<Author>> getAll();
Future<Author> getById(String id); Future<Author> getById(String id);

View file

@ -6,8 +6,8 @@
part of 'author.orm.g.dart'; part of 'author.orm.g.dart';
class _PostgreSqlAuthorOrmImpl implements AuthorOrm { class PostgreSqlAuthorOrm implements AuthorOrm {
_PostgreSqlAuthorOrmImpl(this.connection); PostgreSqlAuthorOrm(this.connection);
final PostgreSQLConnection connection; final PostgreSQLConnection connection;
@ -70,4 +70,8 @@ class _PostgreSqlAuthorOrmImpl implements AuthorOrm {
}); });
return parseRow(r.first); return parseRow(r.first);
} }
AuthorQuery query() {
return null;
}
} }

View file

@ -10,8 +10,7 @@ import 'package:postgres/postgres.dart';
part 'car.postgresql.orm.g.dart'; part 'car.postgresql.orm.g.dart';
abstract class CarOrm { abstract class CarOrm {
factory CarOrm.postgreSql(PostgreSQLConnection connection) = factory CarOrm.postgreSql(PostgreSQLConnection connection) = PostgreSqlCarOrm;
_PostgreSqlCarOrmImpl;
Future<List<Car>> getAll(); Future<List<Car>> getAll();
Future<Car> getById(String id); Future<Car> getById(String id);

View file

@ -6,8 +6,8 @@
part of 'car.orm.g.dart'; part of 'car.orm.g.dart';
class _PostgreSqlCarOrmImpl implements CarOrm { class PostgreSqlCarOrm implements CarOrm {
_PostgreSqlCarOrmImpl(this.connection); PostgreSqlCarOrm(this.connection);
final PostgreSQLConnection connection; final PostgreSQLConnection connection;
@ -79,4 +79,8 @@ class _PostgreSqlCarOrmImpl implements CarOrm {
}); });
return parseRow(r.first); return parseRow(r.first);
} }
CarQuery query() {
return null;
}
} }

View file

@ -11,7 +11,7 @@ part 'customer.postgresql.orm.g.dart';
abstract class CustomerOrm { abstract class CustomerOrm {
factory CustomerOrm.postgreSql(PostgreSQLConnection connection) = factory CustomerOrm.postgreSql(PostgreSQLConnection connection) =
_PostgreSqlCustomerOrmImpl; PostgreSqlCustomerOrm;
Future<List<Customer>> getAll(); Future<List<Customer>> getAll();
Future<Customer> getById(String id); Future<Customer> getById(String id);

View file

@ -6,8 +6,8 @@
part of 'customer.orm.g.dart'; part of 'customer.orm.g.dart';
class _PostgreSqlCustomerOrmImpl implements CustomerOrm { class PostgreSqlCustomerOrm implements CustomerOrm {
_PostgreSqlCustomerOrmImpl(this.connection); PostgreSqlCustomerOrm(this.connection);
final PostgreSQLConnection connection; final PostgreSQLConnection connection;
@ -67,4 +67,8 @@ class _PostgreSqlCustomerOrmImpl implements CustomerOrm {
}); });
return parseRow(r.first); return parseRow(r.first);
} }
CustomerQuery query() {
return null;
}
} }

View file

@ -11,7 +11,7 @@ part 'foot.postgresql.orm.g.dart';
abstract class FootOrm { abstract class FootOrm {
factory FootOrm.postgreSql(PostgreSQLConnection connection) = factory FootOrm.postgreSql(PostgreSQLConnection connection) =
_PostgreSqlFootOrmImpl; PostgreSqlFootOrm;
Future<List<Foot>> getAll(); Future<List<Foot>> getAll();
Future<Foot> getById(String id); Future<Foot> getById(String id);

View file

@ -6,8 +6,8 @@
part of 'foot.orm.g.dart'; part of 'foot.orm.g.dart';
class _PostgreSqlFootOrmImpl implements FootOrm { class PostgreSqlFootOrm implements FootOrm {
_PostgreSqlFootOrmImpl(this.connection); PostgreSqlFootOrm(this.connection);
final PostgreSQLConnection connection; final PostgreSQLConnection connection;
@ -73,4 +73,8 @@ class _PostgreSqlFootOrmImpl implements FootOrm {
}); });
return parseRow(r.first); return parseRow(r.first);
} }
FootQuery query() {
return null;
}
} }

View file

@ -11,7 +11,7 @@ part 'fruit.postgresql.orm.g.dart';
abstract class FruitOrm { abstract class FruitOrm {
factory FruitOrm.postgreSql(PostgreSQLConnection connection) = factory FruitOrm.postgreSql(PostgreSQLConnection connection) =
_PostgreSqlFruitOrmImpl; PostgreSqlFruitOrm;
Future<List<Fruit>> getAll(); Future<List<Fruit>> getAll();
Future<Fruit> getById(String id); Future<Fruit> getById(String id);

View file

@ -6,8 +6,8 @@
part of 'fruit.orm.g.dart'; part of 'fruit.orm.g.dart';
class _PostgreSqlFruitOrmImpl implements FruitOrm { class PostgreSqlFruitOrm implements FruitOrm {
_PostgreSqlFruitOrmImpl(this.connection); PostgreSqlFruitOrm(this.connection);
final PostgreSQLConnection connection; final PostgreSQLConnection connection;
@ -73,4 +73,8 @@ class _PostgreSqlFruitOrmImpl implements FruitOrm {
}); });
return parseRow(r.first); return parseRow(r.first);
} }
FruitQuery query() {
return null;
}
} }

View file

@ -11,7 +11,7 @@ part 'order.postgresql.orm.g.dart';
abstract class OrderOrm { abstract class OrderOrm {
factory OrderOrm.postgreSql(PostgreSQLConnection connection) = factory OrderOrm.postgreSql(PostgreSQLConnection connection) =
_PostgreSqlOrderOrmImpl; PostgreSqlOrderOrm;
Future<List<Order>> getAll(); Future<List<Order>> getAll();
Future<Order> getById(String id); Future<Order> getById(String id);

View file

@ -6,8 +6,8 @@
part of 'order.orm.g.dart'; part of 'order.orm.g.dart';
class _PostgreSqlOrderOrmImpl implements OrderOrm { class PostgreSqlOrderOrm implements OrderOrm {
_PostgreSqlOrderOrmImpl(this.connection); PostgreSqlOrderOrm(this.connection);
final PostgreSQLConnection connection; final PostgreSQLConnection connection;
@ -79,4 +79,8 @@ class _PostgreSqlOrderOrmImpl implements OrderOrm {
}); });
return parseRow(r.first); return parseRow(r.first);
} }
OrderQuery query() {
return null;
}
} }

View file

@ -11,7 +11,7 @@ part 'role.postgresql.orm.g.dart';
abstract class RoleOrm { abstract class RoleOrm {
factory RoleOrm.postgreSql(PostgreSQLConnection connection) = factory RoleOrm.postgreSql(PostgreSQLConnection connection) =
_PostgreSqlRoleOrmImpl; PostgreSqlRoleOrm;
Future<List<Role>> getAll(); Future<List<Role>> getAll();
Future<Role> getById(String id); Future<Role> getById(String id);

View file

@ -6,8 +6,8 @@
part of 'role.orm.g.dart'; part of 'role.orm.g.dart';
class _PostgreSqlRoleOrmImpl implements RoleOrm { class PostgreSqlRoleOrm implements RoleOrm {
_PostgreSqlRoleOrmImpl(this.connection); PostgreSqlRoleOrm(this.connection);
final PostgreSQLConnection connection; final PostgreSQLConnection connection;
@ -70,4 +70,8 @@ class _PostgreSqlRoleOrmImpl implements RoleOrm {
}); });
return parseRow(r.first); return parseRow(r.first);
} }
RoleQuery query() {
return null;
}
} }

View file

@ -33,7 +33,7 @@ main() {
dateYmdHms.format(MILENNIUM) dateYmdHms.format(MILENNIUM)
]; ];
print(row); print(row);
var car = CarQuery.parseRow(row); var car = PostgreSqlCarOrm.parseRow(row);
print(car.toJson()); print(car.toJson());
expect(car.id, '0'); expect(car.id, '0');
expect(car.make, 'Mazda'); expect(car.make, 'Mazda');