Add basic annotation reader
This commit is contained in:
parent
025f8bd0ff
commit
ecfd99e865
2 changed files with 19 additions and 5 deletions
|
@ -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'));
|
19
angel_orm_generator/lib/src/readers.dart
Normal file
19
angel_orm_generator/lib/src/readers.dart
Normal 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;
|
||||
}
|
Loading…
Reference in a new issue