map method

  1. @override
CourseTableSlot 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
CourseTableSlot map(Map<String, dynamic> data, {String? tablePrefix}) {
  final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
  return CourseTableSlot(
    id: attachedDatabase.typeMapping.read(
      DriftSqlType.int,
      data['${effectivePrefix}id'],
    )!,
    number: attachedDatabase.typeMapping.read(
      DriftSqlType.string,
      data['${effectivePrefix}number'],
    )!,
    nameZh: attachedDatabase.typeMapping.read(
      DriftSqlType.string,
      data['${effectivePrefix}name_zh'],
    ),
    nameEn: attachedDatabase.typeMapping.read(
      DriftSqlType.string,
      data['${effectivePrefix}name_en'],
    ),
    credits: attachedDatabase.typeMapping.read(
      DriftSqlType.double,
      data['${effectivePrefix}credits'],
    )!,
    hours: attachedDatabase.typeMapping.read(
      DriftSqlType.int,
      data['${effectivePrefix}hours'],
    )!,
    dayOfWeek: $SchedulesTable.$converterdayOfWeek.fromSql(
      attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}day_of_week'],
      )!,
    ),
    period: $SchedulesTable.$converterperiod.fromSql(
      attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}period'],
      )!,
    ),
    nameZh1: attachedDatabase.typeMapping.read(
      DriftSqlType.string,
      data['${effectivePrefix}name_zh1'],
    ),
  );
}