Skip to content

Commit 1340ecb

Browse files
mbrandonwgithub-actions[bot]
authored andcommitted
Run swift-format
1 parent 5d8d1b1 commit 1340ecb

File tree

2 files changed

+17
-17
lines changed

2 files changed

+17
-17
lines changed

Sources/StructuredQueriesMacros/SelectionMacro.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ extension SelectionMacro: ExtensionMacro {
100100
case .some(let label) where label.text == "primaryKey":
101101
guard !declaration.hasMacroApplication("Table")
102102
else { continue }
103-
103+
104104
var newArguments = arguments
105105
newArguments.remove(at: argumentIndex)
106106
diagnostics.append(
@@ -262,7 +262,7 @@ extension SelectionMacro: MemberMacro {
262262
case .some(let label) where label.text == "primaryKey":
263263
guard !declaration.hasMacroApplication("Table")
264264
else { continue }
265-
265+
266266
var newArguments = arguments
267267
newArguments.remove(at: argumentIndex)
268268
expansionFailed = true

Sources/StructuredQueriesSQLiteCore/Documentation.docc/Articles/Views.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ private struct ReminderWithList {
2424
```
2525

2626
Note that we have applied both the `@Table` macro and `@Selection` macro. This is similar to what
27-
one does with common table expressions, and it allows one to represent a type that for intents and
27+
one does with common table expressions, and it allows one to represent a type that for intents and
2828
purposes seems like a regular SQLite table, but it's not actually persisted in the database.
2929

30-
With that type defined we can use the
30+
With that type defined we can use the
3131
``StructuredQueriesCore/Table/createTemporaryView(ifNotExists:as:)`` to create a SQL query that
3232
creates a temporary view. You provide a select statement that selects all the data needed for the
3333
view:
@@ -46,27 +46,27 @@ ReminderWithList.createTemporaryView(
4646
```
4747

4848
Once that is executed in your database you are free to query from this table as if it is a regular
49-
table:
49+
table:
5050

5151
@Row {
5252
@Column {
5353
```swift
5454
ReminderWithList
55-
.order {
56-
($0.remindersListTitle,
57-
$0.reminderTitle)
55+
.order {
56+
($0.remindersListTitle,
57+
$0.reminderTitle)
5858
}
5959
.limit(3)
6060
```
6161
}
6262
@Column {
6363
```sql
64-
SELECT
65-
"reminderWithLists"."reminderTitle",
64+
SELECT
65+
"reminderWithLists"."reminderTitle",
6666
"reminderWithLists"."remindersListTitle"
6767
FROM "reminderWithLists"
68-
ORDER BY
69-
"reminderWithLists"."remindersListTitle",
68+
ORDER BY
69+
"reminderWithLists"."remindersListTitle",
7070
"reminderWithLists"."reminderTitle"
7171
LIMIT 3
7272
```
@@ -85,12 +85,12 @@ example if you try to insert into `ReminderWithList` you will be met with a SQL
8585
```swift
8686
ReminderWithList.insert {
8787
ReminderWithList(
88-
reminderTitle: "Morning sync",
88+
reminderTitle: "Morning sync",
8989
remindersListTitle: "Business"
9090
)
9191
}
9292
// 🛑 cannot modify reminderWithLists because it is a view
93-
```
93+
```
9494

9595
However, it is possible to restore inserts if you can describe how inserting a `(String, String)`
9696
pair into the table ultimately re-routes to inserts into your actual, non-view tables. The logic
@@ -100,7 +100,7 @@ we could try first creating a new list with the title, and then use that new lis
100100
reminder with the title. Or, we could decide that we will not allow creating a new list, and
101101
instead we will just find an existing list with the title, and if we cannot then we fail the query.
102102

103-
In order to demonstrate this technique, we will use the latter rerouting logic: when a
103+
In order to demonstrate this technique, we will use the latter rerouting logic: when a
104104
`(String, String)` is inserted into `ReminderWithList` we will only create a new reminder with
105105
the title specified, and we will only find an existing reminders list (if one exists) for the title
106106
specified. And to implement this rerouting logic, one uses a [temporary trigger](<doc:Triggers>) on
@@ -112,7 +112,7 @@ ReminderWithList.createTemporaryTrigger(
112112
insteadOf: .insert { new in
113113
Reminder.insert {
114114
(
115-
$0.title,
115+
$0.title,
116116
$0.remindersListID
117117
)
118118
} values: {
@@ -133,7 +133,7 @@ view:
133133
```swift
134134
ReminderWithList.insert {
135135
ReminderWithList(
136-
reminderTitle: "Morning sync",
136+
reminderTitle: "Morning sync",
137137
remindersListTitle: "Business"
138138
)
139139
}

0 commit comments

Comments
 (0)