RowAdapter

public protocol RowAdapter : _RowAdapter

RowAdapter is a protocol that helps two incompatible row interfaces working together.

GRDB ships with four concrete types that adopt the RowAdapter protocol:

To use a row adapter, provide it to any method that fetches:

let adapter = SuffixRowAdapter(fromIndex: 2)
let sql = "SELECT 1 AS foo, 2 AS bar, 3 AS baz"

// [baz:3]
try Row.fetchOne(db, sql: sql, adapter: adapter)
  • addingScopes(_:) Extension method

    Returns an adapter based on self, with added scopes.

    If self already defines scopes, the added scopes replace eventual existing scopes with the same name.

    Declaration

    Swift

    public func addingScopes(_ scopes: [String : RowAdapter]) -> RowAdapter

    Parameters

    scopes

    A dictionary that maps scope names to row adapters.