Add basic annotation reader

This commit is contained in:
Tobe O 2018-08-24 09:03:31 -04:00
parent 025f8bd0ff
commit ecfd99e865
2 changed files with 19 additions and 5 deletions

View file

@ -1,5 +0,0 @@
import 'package:code_builder/code_builder.dart';
final TypeReference $void = new TypeReference((b) => b.symbol = 'void');
final Expression override = new CodeExpression(new Code('override'));

View file

@ -0,0 +1,19 @@
import 'package:analyzer/dart/constant/value.dart';
import 'package:angel_orm/angel_orm.dart';
import 'package:source_gen/source_gen.dart';
ORM reviveORMAnnotation(ConstantReader reader) {
return ORM(reader.peek('tableName')?.stringValue);
}
class ColumnReader {
final ConstantReader reader;
ColumnReader(this.reader);
bool get isNullable => reader.peek('isNullable')?.boolValue ?? true;
int get length => reader.peek('length')?.intValue;
DartObject get defaultValue => reader.peek('defaultValue')?.objectValue;
}