mirror of
https://github.com/groue/GRDB.swift
synced 2026-11-22 04:00:39 +00:00
Document INTEGER PRIMARY KEY in WITHOUT ROWID tables
This commit is contained in:
1 parent
4373b3a49b
commit
8511cfd399
1 file changed
+15
-1
@@ -1606,7 +1606,19 @@ extension ForeignKeyViolation: CustomStringConvertible {
|
||||
/// pk.columns // ["citizenID", "countryIsoCode"]
|
||||
/// pk.rowIDColumn // nil
|
||||
/// pk.isRowID // false
|
||||
///
|
||||
/// // CREATE TABLE passport (
|
||||
/// // id INTEGER PRIMARY KEY,
|
||||
/// // name TEXT
|
||||
/// // ) WITHOUT ROWID
|
||||
/// let pk = try db.primaryKey("passport")
|
||||
/// pk.columns // ["id"]
|
||||
/// pk.rowIDColumn // nil
|
||||
/// pk.isRowID // false
|
||||
/// ```
|
||||
///
|
||||
/// An `INTEGER PRIMARY KEY` is an alias for the rowid only in rowid
|
||||
/// tables. In a `WITHOUT ROWID` table, it is a regular primary key.
|
||||
public struct PrimaryKeyInfo: Sendable {
|
||||
private enum Impl {
|
||||
/// The hidden rowID.
|
||||
@@ -1660,7 +1672,9 @@ public struct PrimaryKeyInfo: Sendable {
|
||||
}
|
||||
|
||||
/// When not nil, the name of the column that contains the
|
||||
/// `INTEGER PRIMARY KEY`.
|
||||
/// `INTEGER PRIMARY KEY` of a rowid table.
|
||||
///
|
||||
/// This is nil for `WITHOUT ROWID` tables, which have no rowid.
|
||||
public var rowIDColumn: String? {
|
||||
switch impl {
|
||||
case .hiddenRowID:
|
||||
|
||||
Reference in new issue
Block a user