toColumns method

  1. @override
Map<String, Expression<Object>> toColumns(
  1. bool nullToAbsent
)

Converts this object into a map of column names to expressions to insert or update.

Note that the keys in the map are the raw column names, they're not escaped.

The nullToAbsent can be used on DataClasses to control whether null fields should be set to a null constant in sql or absent from the map. Other implementations ignore that nullToAbsent, it mainly exists for legacy reasons.

Implementation

@override
Map<String, Expression> toColumns(bool nullToAbsent) {
  final map = <String, Expression>{};
  if (id.present) {
    map['id'] = Variable<int>(id.value);
  }
  if (date.present) {
    map['date'] = Variable<String>(date.value);
  }
  if (exception.present) {
    map['exception'] = Variable<String>(exception.value);
  }
  if (deviceInfo.present) {
    map['device_info'] = Variable<String>(deviceInfo.value);
  }
  return map;
}