Skip to content

Commit a70aadb

Browse files
authored
Add PrimaryKeyedTable.primaryKey (pointfreeco#110)
* Add `PrimaryKeyedTable.primaryKey` It can be helpful to be able to pluck off a primary key for a row more simply when dealing with primary keyed tables in the abstract. * docs
1 parent aae2259 commit a70aadb

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

Sources/StructuredQueriesCore/Documentation.docc/Extensions/PrimaryKeyedTable.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,11 @@ Reminder.delete(reminder)
125125

126126
## Topics
127127

128+
### Primary keys
129+
130+
- ``PrimaryKey``
131+
- ``primaryKey-swift.property``
132+
128133
### Drafts
129134

130135
- ``Draft``

Sources/StructuredQueriesCore/PrimaryKeyed.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,10 @@ extension PrimaryKeyedTable {
8686
) -> Where<Self> {
8787
Self.where { $0.primaryKey.eq(primaryKey) }
8888
}
89+
90+
public var primaryKey: PrimaryKey.QueryOutput {
91+
self[keyPath: Self.columns.primaryKey.keyPath]
92+
}
8993
}
9094

9195
extension TableDraft {

0 commit comments

Comments
 (0)