typedColByName<T> method

T? typedColByName<T>(
  1. String columnName
)

Same as colByName but performs conversion of string data, into provided type T, if possible

Conversion is "typesafe", meaning that actual MySQL column type will be checked, to decide is it possible to make such a conversion

Throws MySQLClientException if conversion is not possible

Implementation

T? typedColByName<T>(String columnName) {
  final colIndex = _metadata.columnIndex(columnName);
  final value = _values[colIndex];
  final colDef = _metadata.columns[colIndex];

  return colDef.type
      .convertStringValueToProvidedType<T>(value, colDef.columnLength);
}