map method

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

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

Implementation

@override
AlbumData map(Map<String, dynamic> data, {String? tablePrefix}) {
  final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
  return AlbumData(
    id: attachedDatabase.typeMapping.read(
      DriftSqlType.int,
      data['${effectivePrefix}id'],
    )!,
    code: attachedDatabase.typeMapping.read(
      DriftSqlType.string,
      data['${effectivePrefix}code'],
    )!,
    name: attachedDatabase.typeMapping.read(
      DriftSqlType.string,
      data['${effectivePrefix}name'],
    )!,
    nameInEnglish: attachedDatabase.typeMapping.read(
      DriftSqlType.string,
      data['${effectivePrefix}name_in_english'],
    )!,
    seqNum: attachedDatabase.typeMapping.read(
      DriftSqlType.int,
      data['${effectivePrefix}seq_num'],
    )!,
    published: attachedDatabase.typeMapping.read(
      DriftSqlType.bool,
      data['${effectivePrefix}published'],
    )!,
    locked: attachedDatabase.typeMapping.read(
      DriftSqlType.bool,
      data['${effectivePrefix}locked'],
    )!,
    imagePath: attachedDatabase.typeMapping.read(
      DriftSqlType.string,
      data['${effectivePrefix}image_path'],
    ),
    publishedSongCount: attachedDatabase.typeMapping.read(
      DriftSqlType.int,
      data['${effectivePrefix}published_song_count'],
    )!,
    totalSongCount: attachedDatabase.typeMapping.read(
      DriftSqlType.int,
      data['${effectivePrefix}total_song_count'],
    )!,
    description: attachedDatabase.typeMapping.read(
      DriftSqlType.string,
      data['${effectivePrefix}description'],
    ),
    note: attachedDatabase.typeMapping.read(
      DriftSqlType.string,
      data['${effectivePrefix}note'],
    ),
  );
}