map method

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

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

Implementation

@override
EmployeeData map(Map<String, dynamic> data, {String? tablePrefix}) {
  final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
  return EmployeeData(
    id: attachedDatabase.typeMapping.read(
      DriftSqlType.int,
      data['${effectivePrefix}id'],
    )!,
    empNumber: attachedDatabase.typeMapping.read(
      DriftSqlType.string,
      data['${effectivePrefix}emp_number'],
    )!,
    name: attachedDatabase.typeMapping.read(
      DriftSqlType.string,
      data['${effectivePrefix}name'],
    )!,
    email: attachedDatabase.typeMapping.read(
      DriftSqlType.string,
      data['${effectivePrefix}email'],
    )!,
    employeePositionId: attachedDatabase.typeMapping.read(
      DriftSqlType.int,
      data['${effectivePrefix}employee_position_id'],
    )!,
    departmentId: attachedDatabase.typeMapping.read(
      DriftSqlType.int,
      data['${effectivePrefix}department_id'],
    )!,
    birthday: attachedDatabase.typeMapping.read(
      DriftSqlType.dateTime,
      data['${effectivePrefix}birthday'],
    )!,
    hireDate: attachedDatabase.typeMapping.read(
      DriftSqlType.dateTime,
      data['${effectivePrefix}hire_date'],
    )!,
    imagePath: attachedDatabase.typeMapping.read(
      DriftSqlType.string,
      data['${effectivePrefix}image_path'],
    ),
    address: attachedDatabase.typeMapping.read(
      DriftSqlType.string,
      data['${effectivePrefix}address'],
    ),
  );
}