cast<D2 extends Object> method
- [BaseSqlType<
D2> ? type]
Generates a CAST(expression AS TYPE)
expression.
Note that this does not do a meaningful conversion for drift-only types
like bool
or DateTime
. Both would simply generate a CAST AS INT
expression.
The optional type
parameter can be used to specify the SQL type to cast
to. This is mainly useful for CustomSqlTypes. For types supported by
drift, DriftSqlType.forType will be used as a default.
Implementation
Expression<D2> cast<D2 extends Object>([BaseSqlType<D2>? type]) {
return _CastInSqlExpression<D, D2>(
this, type ?? DriftSqlType.forType<D2>());
}