Skip to content

Commit 14efe21

Browse files
authored
Don't execute @FetchOne queries for _Selections. (#246)
* Don't execute `@FetchOne` queries for `_Selection`s. * wip
1 parent 320a002 commit 14efe21

File tree

5 files changed

+19
-7
lines changed

5 files changed

+19
-7
lines changed

Examples/Examples.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Package.resolved

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ let package = Package(
3636
.package(url: "https://github.com/pointfreeco/swift-snapshot-testing", from: "1.18.4"),
3737
.package(
3838
url: "https://github.com/pointfreeco/swift-structured-queries",
39-
from: "0.22.0",
39+
branch: "optional-selections",
4040
traits: [
4141
.trait(name: "StructuredQueriesTagged", condition: .when(traits: ["SQLiteDataTagged"]))
4242
]

[email protected]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ let package = Package(
2828
.package(url: "https://github.com/pointfreeco/swift-dependencies", from: "1.9.0"),
2929
.package(url: "https://github.com/pointfreeco/swift-sharing", from: "2.3.0"),
3030
.package(url: "https://github.com/pointfreeco/swift-snapshot-testing", from: "1.18.4"),
31-
.package(url: "https://github.com/pointfreeco/swift-structured-queries", from: "0.22.0"),
31+
.package(url: "https://github.com/pointfreeco/swift-structured-queries", branch: "optional-selections"),
3232
.package(url: "https://github.com/pointfreeco/xctest-dynamic-overlay", from: "1.5.0"),
3333
],
3434
targets: [

Sources/SQLiteData/FetchOne.swift

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,18 @@ public struct FetchOne<Value: Sendable>: Sendable {
121121
)
122122
}
123123

124+
/// Initializes this property with a wrapped value.
125+
///
126+
/// - Parameter wrappedValue: A default value to associate with this property.
127+
public init(wrappedValue: sending Value)
128+
where
129+
Value: _OptionalProtocol,
130+
Value: _Selection,
131+
Value.QueryOutput == Value
132+
{
133+
sharedReader = SharedReader(value: wrappedValue)
134+
}
135+
124136
/// Initializes this property with a query associated with the wrapped value.
125137
///
126138
/// - Parameters:

0 commit comments

Comments
 (0)