SQLPrimaryKeyExpression

public struct SQLPrimaryKeyExpression : SQLExpression

Experimental

SQLPrimaryKeyExpression is the primary key of a table.

For tables that have no explicit primary key, SQLPrimaryKeyExpression is the rowid column.

For tables whose primary key spans several columns, the current implementation of SQLPrimaryKeyExpression also is the rowid column. Future GRDB versions may return a row value.

For example:

struct Player: TableRecord { ... }

let player = dbQueue.read { db in
    try Player.filter(Player.primaryKey == 12).fetchOne(db)
}