entityTypeToSQLType method
MapEntry<String, MapEntry<String, String> > ?
entityTypeToSQLType(
- TypeInfo type,
- String? column, {
- List<
EntityField> ? entityFieldAnnotations,
Returns info for the column: table -> idName: sqlType
Implementation
MapEntry<String, MapEntry<String, String>>? entityTypeToSQLType(
TypeInfo type, String? column,
{List<EntityField>? entityFieldAnnotations}) {
var typeEntityRepository = getEntityRepositoryByTypeInfo(type);
if (typeEntityRepository == null) return null;
var entityHandler = typeEntityRepository.entityHandler;
var idName = entityHandler.idFieldName();
var idType = entityHandler.idType();
var idEntityAnnotations = entityHandler
.getFieldEntityAnnotations(null, idName)
?.whereType<EntityField>()
.toList();
var sqlType = foreignKeyTypeToSQLType(TypeInfo.fromType(idType), idName,
entityFieldAnnotations: idEntityAnnotations);
if (sqlType == null) return null;
var table = getTableForEntityRepository(typeEntityRepository);
return MapEntry(table, MapEntry(idName, sqlType));
}