Static Methodgrdb 7.4.0GRDB

fetchAll(_:keys:)

Returns an array of records identified by the provided unique keys (primary key or any key with a unique index on it).

FetchableRecord+TableRecord.swift:450
static func fetchAll(_ db: Database, keys: [[String : (any DatabaseValueConvertible)?]]) throws -> [Self]

Parameters

db

A database connection.

keys

An array of key dictionaries.

Returns

An array of records.

Throws

A DatabaseError whenever an SQLite error occurs.

For example:

try dbQueue.read { db in
    let players = try Player.fetchAll(db, keys: [
        ["email": "a@example.com"],
        ["email": "b@example.com"]])
}

The order in which the records are returned is undefined (ref).