Static Methodgrdb 7.3.0GRDB

fetchAll(_:ids:)

Returns an array of records identified by their primary keys.

FetchableRecord+TableRecord.swift:276
static func fetchAll(_ db: Database, ids: some Collection<ID>) throws -> [Self]

Parameters

db

A database connection.

ids

A collection of primary keys.

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, ids: [1, 2, 3])
    let players = try Country.fetchAll(db, ids: ["FR", "US"])
}

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