ColumnOperation.transform constructor

ColumnOperation.transform(
  1. String name,
  2. Object? transform(
    1. Object? value,
    2. Map<String, dynamic> row
    ), {
  3. bool applyIfAbsent = false,
  4. String? sqlExpression,
})

Replaces the value of name with transform(value, row).

Rows that do not contain name are skipped unless applyIfAbsent is true (in which case the transform receives null as the value).

For SQL adapters, sqlExpression is the SQL counterpart of the Dart closure (UPDATE t SET name = sqlExpression); without it the operation cannot be expressed as SQL. Ignored by the map-based migration path.

Implementation

factory ColumnOperation.transform(
  String name,
  Object? Function(Object? value, Map<String, dynamic> row) transform, {
  bool applyIfAbsent = false,
  String? sqlExpression,
}) =>
    TransformColumn(name, transform, applyIfAbsent: applyIfAbsent, sqlExpression: sqlExpression);