PrimaryKeyInfo
Primary keys are returned from the Database.primaryKey(_:) method.
When the table’s primary key is the rowid:
// CREATE TABLE item (name TEXT)
let pk = try db.primaryKey("item")
pk.columns     // ["rowid"]
pk.rowIDColumn // nil
pk.isRowID     // true
// CREATE TABLE citizen (
//   id INTEGER PRIMARY KEY,
//   name TEXT
// )
let pk = try db.primaryKey("citizen")!
pk.columns     // ["id"]
pk.rowIDColumn // "id"
pk.isRowID     // true
When the table’s primary key is not the rowid:
// CREATE TABLE country (
//   isoCode TEXT NOT NULL PRIMARY KEY
//   name TEXT
// )
let pk = db.primaryKey("country")!
pk.columns     // ["isoCode"]
pk.rowIDColumn // nil
pk.isRowID     // false
// CREATE TABLE citizenship (
//   citizenID INTEGER NOT NULL REFERENCES citizen(id)
//   countryIsoCode TEXT NOT NULL REFERENCES country(isoCode)
//   PRIMARY KEY (citizenID, countryIsoCode)
// )
let pk = db.primaryKey("citizenship")!
pk.columns     // ["citizenID", "countryIsoCode"]
pk.rowIDColumn // nil
pk.isRowID     // false
          - 
                  
                  
The columns in the primary key; this array is never empty.
 - 
                  
                  
When not nil, the name of the column that contains the INTEGER PRIMARY KEY.
 - 
                  
                  
When true, the primary key is the rowid:
 
View on GitHub
Install in Dash
        PrimaryKeyInfo Structure Reference