ColumnMapping

public struct ColumnMapping : RowAdapter

ColumnMapping is a row adapter that maps column names.

let adapter = ColumnMapping(["foo": "bar"])
let sql = "SELECT 'foo' AS foo, 'bar' AS bar, 'baz' AS baz"

// [foo:"bar"]
try Row.fetchOne(db, sql: sql, adapter: adapter)
  • Creates a ColumnMapping with a dictionary from mapped column names to column names in a base row.

    Declaration

    Swift

    public init(_ mapping: [String : String])