typeOf function

PostgresqlDataType? typeOf(
  1. Expression expression,
  2. Iterable<(PostgresqlDataAttribute, PostgresqlRelation?)> attributes
)

Implementation

PostgresqlDataType? typeOf(
  Expression expression,
  Iterable<(PostgresqlDataAttribute, PostgresqlRelation?)> attributes,
) => switch (expression) {
  ValueExpression(:final value) => PostgresqlDataType.findForDynamic(value),
  final DataField field => _findDataAttribute(attributes, field).$1.type,
  PostgresqlFunctionExpression(:final returnType) => returnType,
  PostgresqlCastExpression(:final type) => type,
  _ => null,
};