platform/angel_orm_generator/lib/src/readers.dart

22 lines
621 B
Dart
Raw Normal View History

2018-08-24 13:03:31 +00:00
import 'package:analyzer/dart/constant/value.dart';
import 'package:angel_orm/angel_orm.dart';
import 'package:source_gen/source_gen.dart';
2018-08-24 13:17:04 +00:00
const TypeChecker columnTypeChecker = const TypeChecker.fromRuntime(Column);
2018-08-24 14:17:12 +00:00
Orm reviveORMAnnotation(ConstantReader reader) {
2018-12-01 19:03:43 +00:00
return Orm(tableName: reader.peek('tableName')?.stringValue);
2018-08-24 13:03:31 +00:00
}
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;
}