Gen base postgres class
This commit is contained in:
parent
c2fe5449a7
commit
41f1165a1f
30 changed files with 190 additions and 9 deletions
|
@ -37,9 +37,36 @@ class PostgreSqlOrmGenerator extends GeneratorForAnnotation<Orm> {
|
|||
Library buildOrmLibrary(AssetId inputId, OrmBuildContext ctx) {
|
||||
return new Library((lib) {
|
||||
// Add part of
|
||||
var libFile =
|
||||
p.setExtension(p.basename(inputId.uri.path), '.orm.g.dart');
|
||||
var libFile = p.setExtension(p.basename(inputId.uri.path), '.orm.g.dart');
|
||||
lib.body.add(new Code("part of '$libFile';"));
|
||||
|
||||
// Add _PostgresqlFooOrmImpl
|
||||
lib.body.add(buildOrmClass(ctx));
|
||||
});
|
||||
}
|
||||
|
||||
Class buildOrmClass(OrmBuildContext ctx) {
|
||||
return new Class((clazz) {
|
||||
var rc = ctx.buildContext.modelClassNameRecase;
|
||||
clazz
|
||||
..name = '_Postgresql${rc.pascalCase}OrmImpl'
|
||||
..implements.add(refer('${rc.pascalCase}Orm'))
|
||||
|
||||
// final PostgreSQLConnection connection;
|
||||
..fields.add(new Field((b) {
|
||||
b
|
||||
..modifier = FieldModifier.final$
|
||||
..name = 'connection'
|
||||
..type = refer('PostgreSQLConnection');
|
||||
}))
|
||||
|
||||
// _PostgresqlFooOrmImpl(this.connection);
|
||||
..constructors.add(new Constructor((b) {
|
||||
b
|
||||
..requiredParameters.add(new Parameter((b) => b
|
||||
..name = 'connection'
|
||||
..toThis = true));
|
||||
}));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
// **************************************************************************
|
||||
// MongoDBOrmGenerator
|
||||
// **************************************************************************
|
||||
|
||||
part of 'author.orm.g.dart';
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
import 'dart:async';
|
||||
import 'author.dart';
|
||||
part 'author.postgresql.orm.dart';
|
||||
part 'author.postgresql.orm.g.dart';
|
||||
|
||||
abstract class AuthorOrm {
|
||||
Future<List<Author>> getAll();
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
// **************************************************************************
|
||||
// PostgreSqlOrmGenerator
|
||||
// **************************************************************************
|
||||
|
||||
part of 'author.orm.g.dart';
|
7
angel_orm_generator/test/models/book.mongodb.orm.g.dart
Normal file
7
angel_orm_generator/test/models/book.mongodb.orm.g.dart
Normal file
|
@ -0,0 +1,7 @@
|
|||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
// **************************************************************************
|
||||
// MongoDBOrmGenerator
|
||||
// **************************************************************************
|
||||
|
||||
// Error: Cannot infer SQL column type for field "author" with type "Author".
|
|
@ -0,0 +1,7 @@
|
|||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
// **************************************************************************
|
||||
// PostgreSqlOrmGenerator
|
||||
// **************************************************************************
|
||||
|
||||
// Error: Cannot infer SQL column type for field "author" with type "Author".
|
7
angel_orm_generator/test/models/car.mongodb.orm.g.dart
Normal file
7
angel_orm_generator/test/models/car.mongodb.orm.g.dart
Normal file
|
@ -0,0 +1,7 @@
|
|||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
// **************************************************************************
|
||||
// MongoDBOrmGenerator
|
||||
// **************************************************************************
|
||||
|
||||
part of 'car.orm.g.dart';
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
import 'dart:async';
|
||||
import 'car.dart';
|
||||
part 'car.postgresql.orm.dart';
|
||||
part 'car.postgresql.orm.g.dart';
|
||||
|
||||
abstract class CarOrm {
|
||||
Future<List<Car>> getAll();
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
// **************************************************************************
|
||||
// PostgreSqlOrmGenerator
|
||||
// **************************************************************************
|
||||
|
||||
part of 'car.orm.g.dart';
|
|
@ -0,0 +1,7 @@
|
|||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
// **************************************************************************
|
||||
// MongoDBOrmGenerator
|
||||
// **************************************************************************
|
||||
|
||||
part of 'customer.orm.g.dart';
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
import 'dart:async';
|
||||
import 'customer.dart';
|
||||
part 'customer.postgresql.orm.dart';
|
||||
part 'customer.postgresql.orm.g.dart';
|
||||
|
||||
abstract class CustomerOrm {
|
||||
Future<List<Customer>> getAll();
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
// **************************************************************************
|
||||
// PostgreSqlOrmGenerator
|
||||
// **************************************************************************
|
||||
|
||||
part of 'customer.orm.g.dart';
|
7
angel_orm_generator/test/models/foot.mongodb.orm.g.dart
Normal file
7
angel_orm_generator/test/models/foot.mongodb.orm.g.dart
Normal file
|
@ -0,0 +1,7 @@
|
|||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
// **************************************************************************
|
||||
// MongoDBOrmGenerator
|
||||
// **************************************************************************
|
||||
|
||||
part of 'foot.orm.g.dart';
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
import 'dart:async';
|
||||
import 'foot.dart';
|
||||
part 'foot.postgresql.orm.dart';
|
||||
part 'foot.postgresql.orm.g.dart';
|
||||
|
||||
abstract class FootOrm {
|
||||
Future<List<Foot>> getAll();
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
// **************************************************************************
|
||||
// PostgreSqlOrmGenerator
|
||||
// **************************************************************************
|
||||
|
||||
part of 'foot.orm.g.dart';
|
7
angel_orm_generator/test/models/fruit.mongodb.orm.g.dart
Normal file
7
angel_orm_generator/test/models/fruit.mongodb.orm.g.dart
Normal file
|
@ -0,0 +1,7 @@
|
|||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
// **************************************************************************
|
||||
// MongoDBOrmGenerator
|
||||
// **************************************************************************
|
||||
|
||||
part of 'fruit.orm.g.dart';
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
import 'dart:async';
|
||||
import 'fruit.dart';
|
||||
part 'fruit.postgresql.orm.dart';
|
||||
part 'fruit.postgresql.orm.g.dart';
|
||||
|
||||
abstract class FruitOrm {
|
||||
Future<List<Fruit>> getAll();
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
// **************************************************************************
|
||||
// PostgreSqlOrmGenerator
|
||||
// **************************************************************************
|
||||
|
||||
part of 'fruit.orm.g.dart';
|
7
angel_orm_generator/test/models/leg.mongodb.orm.g.dart
Normal file
7
angel_orm_generator/test/models/leg.mongodb.orm.g.dart
Normal file
|
@ -0,0 +1,7 @@
|
|||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
// **************************************************************************
|
||||
// MongoDBOrmGenerator
|
||||
// **************************************************************************
|
||||
|
||||
// Error: Cannot infer SQL column type for field "foot" with type "Foot".
|
|
@ -0,0 +1,7 @@
|
|||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
// **************************************************************************
|
||||
// PostgreSqlOrmGenerator
|
||||
// **************************************************************************
|
||||
|
||||
// Error: Cannot infer SQL column type for field "foot" with type "Foot".
|
7
angel_orm_generator/test/models/order.mongodb.orm.g.dart
Normal file
7
angel_orm_generator/test/models/order.mongodb.orm.g.dart
Normal file
|
@ -0,0 +1,7 @@
|
|||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
// **************************************************************************
|
||||
// MongoDBOrmGenerator
|
||||
// **************************************************************************
|
||||
|
||||
part of 'order.orm.g.dart';
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
import 'dart:async';
|
||||
import 'order.dart';
|
||||
part 'order.postgresql.orm.dart';
|
||||
part 'order.postgresql.orm.g.dart';
|
||||
|
||||
abstract class OrderOrm {
|
||||
Future<List<Order>> getAll();
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
// **************************************************************************
|
||||
// PostgreSqlOrmGenerator
|
||||
// **************************************************************************
|
||||
|
||||
part of 'order.orm.g.dart';
|
7
angel_orm_generator/test/models/role.mongodb.orm.g.dart
Normal file
7
angel_orm_generator/test/models/role.mongodb.orm.g.dart
Normal file
|
@ -0,0 +1,7 @@
|
|||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
// **************************************************************************
|
||||
// MongoDBOrmGenerator
|
||||
// **************************************************************************
|
||||
|
||||
part of 'role.orm.g.dart';
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
import 'dart:async';
|
||||
import 'role.dart';
|
||||
part 'role.postgresql.orm.dart';
|
||||
part 'role.postgresql.orm.g.dart';
|
||||
|
||||
abstract class RoleOrm {
|
||||
Future<List<Role>> getAll();
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
// **************************************************************************
|
||||
// PostgreSqlOrmGenerator
|
||||
// **************************************************************************
|
||||
|
||||
part of 'role.orm.g.dart';
|
7
angel_orm_generator/test/models/tree.mongodb.orm.g.dart
Normal file
7
angel_orm_generator/test/models/tree.mongodb.orm.g.dart
Normal file
|
@ -0,0 +1,7 @@
|
|||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
// **************************************************************************
|
||||
// MongoDBOrmGenerator
|
||||
// **************************************************************************
|
||||
|
||||
// Error: Cannot infer SQL column type for field "fruits" with type "List".
|
|
@ -0,0 +1,7 @@
|
|||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
// **************************************************************************
|
||||
// PostgreSqlOrmGenerator
|
||||
// **************************************************************************
|
||||
|
||||
// Error: Cannot infer SQL column type for field "fruits" with type "List".
|
7
angel_orm_generator/test/models/user.mongodb.orm.g.dart
Normal file
7
angel_orm_generator/test/models/user.mongodb.orm.g.dart
Normal file
|
@ -0,0 +1,7 @@
|
|||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
// **************************************************************************
|
||||
// MongoDBOrmGenerator
|
||||
// **************************************************************************
|
||||
|
||||
// Error: Cannot infer SQL column type for field "roles" with type "List".
|
|
@ -0,0 +1,7 @@
|
|||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
// **************************************************************************
|
||||
// PostgreSqlOrmGenerator
|
||||
// **************************************************************************
|
||||
|
||||
// Error: Cannot infer SQL column type for field "roles" with type "List".
|
Loading…
Reference in a new issue