mapToSqlParameter method
Maps the dartValue
to a value understood by the underlying database
driver.
Implementation
@override
Object mapToSqlParameter(GenerationContext context, DartT dartValue) {
if (context.dialect == SqlDialect.postgres) {
// Enums are treated as null pgtype
const PgType? pgType = null;
final String enumStr = codec.encode(dartValue);
return pg_mapping.mapToSql(pgType, enumStr);
} else {
return super.mapToSqlParameter(context, dartValue);
}
}