toFields method
Convert defined constant tables into SqfEntityFieldType
Implementation
List<SqfEntityFieldType>? toFields(SqfEntityTable table) {
if (table.fields == null) {
return null;
}
final fields = <SqfEntityFieldType>[];
for (final field in table.fields!) {
SqfEntityFieldType _field;
if (field is SqfEntityFieldRelationship) {
_field = SqfEntityFieldRelationshipBase(field.parentTable == null ? null : toTable(field.parentTable!), field.deleteRule!)
..relationType = field.relationType == null ? RelationType.ONE_TO_MANY : field.relationType!
..manyToManyTableName = field.manyToManyTableName
..fieldName = field.fieldName
..init();
getFieldProperties(field, _field);
} else {
_field = SqfEntityFieldBase(field.fieldName!, field.dbType!);
getFieldProperties(field, _field);
}
fields.add(_field);
}
return fields;
}