map method

  1. @override
StoredAction map(
  1. Map<String, dynamic> data, {
  2. String? tablePrefix,
})
override

Maps the given row returned by the database into the fitting data class.

Implementation

@override
StoredAction map(Map<String, dynamic> data, {String? tablePrefix}) {
  final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
  return StoredAction(
    id: attachedDatabase.typeMapping.read(
      DriftSqlType.string,
      data['${effectivePrefix}id'],
    )!,
    accountKey: attachedDatabase.typeMapping.read(
      DriftSqlType.string,
      data['${effectivePrefix}account_key'],
    )!,
    actionKey: attachedDatabase.typeMapping.read(
      DriftSqlType.string,
      data['${effectivePrefix}action_key'],
    )!,
    version: attachedDatabase.typeMapping.read(
      DriftSqlType.int,
      data['${effectivePrefix}version'],
    )!,
    kind: attachedDatabase.typeMapping.read(
      DriftSqlType.string,
      data['${effectivePrefix}kind'],
    )!,
    payloadJson: attachedDatabase.typeMapping.read(
      DriftSqlType.string,
      data['${effectivePrefix}payload_json'],
    )!,
    status: attachedDatabase.typeMapping.read(
      DriftSqlType.string,
      data['${effectivePrefix}status'],
    )!,
    orderingKey: attachedDatabase.typeMapping.read(
      DriftSqlType.string,
      data['${effectivePrefix}ordering_key'],
    ),
    rowTableId: attachedDatabase.typeMapping.read(
      DriftSqlType.string,
      data['${effectivePrefix}row_table_id'],
    ),
    rowKey: attachedDatabase.typeMapping.read(
      DriftSqlType.string,
      data['${effectivePrefix}row_key'],
    ),
    queuePosition: attachedDatabase.typeMapping.read(
      DriftSqlType.int,
      data['${effectivePrefix}queue_position'],
    )!,
    attemptCount: attachedDatabase.typeMapping.read(
      DriftSqlType.int,
      data['${effectivePrefix}attempt_count'],
    )!,
    nextAttemptAt: attachedDatabase.typeMapping.read(
      DriftSqlType.dateTime,
      data['${effectivePrefix}next_attempt_at'],
    ),
    lastError: attachedDatabase.typeMapping.read(
      DriftSqlType.string,
      data['${effectivePrefix}last_error'],
    ),
    createdAt: attachedDatabase.typeMapping.read(
      DriftSqlType.dateTime,
      data['${effectivePrefix}created_at'],
    )!,
    updatedAt: attachedDatabase.typeMapping.read(
      DriftSqlType.dateTime,
      data['${effectivePrefix}updated_at'],
    )!,
  );
}