Ignore *.g.part
This commit is contained in:
parent
453f0f9d0e
commit
3f55473164
5 changed files with 35 additions and 1 deletions
1
angel_orm_generator/.gitignore
vendored
1
angel_orm_generator/.gitignore
vendored
|
@ -54,3 +54,4 @@ com_crashlytics_export_strings.xml
|
||||||
crashlytics.properties
|
crashlytics.properties
|
||||||
crashlytics-build.properties
|
crashlytics-build.properties
|
||||||
fabric.properties
|
fabric.properties
|
||||||
|
*.g.part
|
10
angel_orm_generator/build.yaml
Normal file
10
angel_orm_generator/build.yaml
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
builders:
|
||||||
|
angel_orm:
|
||||||
|
import: "package:angel_orm_generator/angel_orm_generator.dart"
|
||||||
|
builder_factories:
|
||||||
|
- ormBuilder
|
||||||
|
auto_apply: root_package
|
||||||
|
build_to: source
|
||||||
|
build_extensions:
|
||||||
|
.dart:
|
||||||
|
- ".orm.g.dart"
|
|
@ -0,0 +1,3 @@
|
||||||
|
export 'src/orm_build_context.dart';
|
||||||
|
export 'src/orm_generator.dart';
|
||||||
|
export 'src/readers.dart';
|
20
angel_orm_generator/lib/src/orm_generator.dart
Normal file
20
angel_orm_generator/lib/src/orm_generator.dart
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
import 'package:analyzer/dart/element/element.dart';
|
||||||
|
import 'package:angel_orm/angel_orm.dart';
|
||||||
|
import 'package:build/build.dart';
|
||||||
|
import 'package:source_gen/source_gen.dart';
|
||||||
|
|
||||||
|
Builder ormBuilder(_) {
|
||||||
|
return new LibraryBuilder(new OrmGenerator(),
|
||||||
|
generatedExtension: '.orm.g.dart');
|
||||||
|
}
|
||||||
|
|
||||||
|
class OrmGenerator extends GeneratorForAnnotation<ORM> {
|
||||||
|
@override
|
||||||
|
generateForAnnotatedElement(
|
||||||
|
Element element, ConstantReader annotation, BuildStep buildStep) {
|
||||||
|
if (element is ClassElement) {
|
||||||
|
} else {
|
||||||
|
throw 'The @Orm() annotation can only be applied to classes.';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -9,7 +9,7 @@ part 'order.g.dart';
|
||||||
@orm
|
@orm
|
||||||
@serializable
|
@serializable
|
||||||
class _Order extends Model {
|
class _Order extends Model {
|
||||||
@Join(Customer, 'id')
|
@CanJoin(Customer, 'id')
|
||||||
int customerId;
|
int customerId;
|
||||||
int employeeId;
|
int employeeId;
|
||||||
DateTime orderDate;
|
DateTime orderDate;
|
||||||
|
|
Loading…
Reference in a new issue