logs method

Future<void> logs(
  1. DatabaseSession session,
  2. SessionLogEntry sessionLogEntry,
  3. List<LogEntry> logEntry, {
  4. Transaction? transaction,
})

Creates a relation between this SessionLogEntry and the given LogEntrys by setting each LogEntry's foreign key sessionLogId to refer to this SessionLogEntry.

Implementation

Future<void> logs(
  _i1.DatabaseSession session,
  SessionLogEntry sessionLogEntry,
  List<_i2.LogEntry> logEntry, {
  _i1.Transaction? transaction,
}) async {
  if (logEntry.any((e) => e.id == null)) {
    throw ArgumentError.notNull('logEntry.id');
  }
  if (sessionLogEntry.id == null) {
    throw ArgumentError.notNull('sessionLogEntry.id');
  }

  var $logEntry = logEntry
      .map((e) => e.copyWith(sessionLogId: sessionLogEntry.id))
      .toList();
  await session.db.update<_i2.LogEntry>(
    $logEntry,
    columns: [_i2.LogEntry.t.sessionLogId],
    transaction: transaction,
  );
}