map method

  1. @override
TeacherSemester 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
TeacherSemester map(Map<String, dynamic> data, {String? tablePrefix}) {
  final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
  return TeacherSemester(
    id: attachedDatabase.typeMapping.read(
      DriftSqlType.int,
      data['${effectivePrefix}id'],
    )!,
    fetchedAt: attachedDatabase.typeMapping.read(
      DriftSqlType.dateTime,
      data['${effectivePrefix}fetched_at'],
    ),
    teacher: attachedDatabase.typeMapping.read(
      DriftSqlType.int,
      data['${effectivePrefix}teacher'],
    )!,
    semester: attachedDatabase.typeMapping.read(
      DriftSqlType.int,
      data['${effectivePrefix}semester'],
    )!,
    email: attachedDatabase.typeMapping.read(
      DriftSqlType.string,
      data['${effectivePrefix}email'],
    ),
    department: attachedDatabase.typeMapping.read(
      DriftSqlType.int,
      data['${effectivePrefix}department'],
    ),
    title: attachedDatabase.typeMapping.read(
      DriftSqlType.string,
      data['${effectivePrefix}title'],
    ),
    teachingHours: attachedDatabase.typeMapping.read(
      DriftSqlType.double,
      data['${effectivePrefix}teaching_hours'],
    ),
    officeHoursNote: attachedDatabase.typeMapping.read(
      DriftSqlType.string,
      data['${effectivePrefix}office_hours_note'],
    ),
  );
}