Skip to content

Commit dcf489f

Browse files
authored
Add note to draft docs about conformances (#201)
1 parent 603bcbf commit dcf489f

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

Sources/StructuredQueriesCore/Documentation.docc/Articles/PrimaryKeyedTables.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,15 @@ key field is made optional:
5353
let draft = Reminder.Draft(title: "Get groceries")
5454
```
5555

56+
> Note: While the draft type is generated with all of the same fields as your type, it is _not_
57+
> generated with all the same conformances. If your `@Table` type conforms to `Equatable`,
58+
> `Hashable`, `Codable`, `Sendable`, or any other protocol that you wish for the `Draft` type to
59+
> conform to, you must specify this conformance manually _via_ extension. For example:
60+
>
61+
> ```swift
62+
> extension Reminder.Draft: Equatable {}
63+
> ```
64+
5665
The `id` is not necessary to provide because it is optional. This allows you to insert rows into
5766
your database without specifying the id. The library comes with a special
5867
``PrimaryKeyedTable/insert(_:onConflict:)`` method that allows you to insert a row into the database

0 commit comments

Comments
 (0)