Skip to content

Commit e8d9c5d

Browse files
committed
fix
1 parent 441cf53 commit e8d9c5d

4 files changed

Lines changed: 20 additions & 20 deletions

File tree

Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ let package = Package(
3333
.package(url: "https://github.com/pointfreeco/swift-dependencies", from: "1.9.0"),
3434
.package(url: "https://github.com/pointfreeco/xctest-dynamic-overlay", from: "1.5.0"),
3535
.package(url: "https://github.com/pointfreeco/swift-sharing", from: "2.3.0"),
36-
.package(url: "https://github.com/pointfreeco/swift-structured-queries", branch: "optional-protocol"),
36+
.package(url: "https://github.com/pointfreeco/swift-structured-queries", from: "0.4.0"),
3737
],
3838
targets: [
3939
.target(

Sources/SharingGRDBCore/FetchOne.swift

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ public struct FetchOne<Value: Sendable>: Sendable {
104104
/// - database: The database to read from. A value of `nil` will use the default database
105105
/// (`@Dependency(\.defaultDatabase)`).
106106
public init(
107-
wrappedValue: sending Value = .none,
107+
wrappedValue: sending Value = ._none,
108108
database: (any DatabaseReader)? = nil
109109
)
110110
where
@@ -212,7 +212,7 @@ public struct FetchOne<Value: Sendable>: Sendable {
212212
/// - database: The database to read from. A value of `nil` will use the default database
213213
/// (`@Dependency(\.defaultDatabase)`).
214214
public init<S: SelectStatement>(
215-
wrappedValue: Value = .none,
215+
wrappedValue: Value = ._none,
216216
_ statement: S,
217217
database: (any DatabaseReader)? = nil
218218
)
@@ -225,7 +225,7 @@ public struct FetchOne<Value: Sendable>: Sendable {
225225
{
226226
let statement = statement.selectStar().asSelect().limit(1)
227227
sharedReader = SharedReader(
228-
wrappedValue: .none,
228+
wrappedValue: wrappedValue,
229229
.fetch(FetchOneStatementOptionalProtocolRequest(statement: statement), database: database)
230230
)
231231
}
@@ -238,7 +238,7 @@ public struct FetchOne<Value: Sendable>: Sendable {
238238
/// - database: The database to read from. A value of `nil` will use the default database
239239
/// (`@Dependency(\.defaultDatabase)`).
240240
public init<S: StructuredQueriesCore.Statement>(
241-
wrappedValue: Value = .none,
241+
wrappedValue: Value = ._none,
242242
_ statement: S,
243243
database: (any DatabaseReader)? = nil
244244
)
@@ -249,7 +249,7 @@ public struct FetchOne<Value: Sendable>: Sendable {
249249
Value == S.QueryValue.QueryOutput
250250
{
251251
sharedReader = SharedReader(
252-
wrappedValue: .none,
252+
wrappedValue: wrappedValue,
253253
.fetch(
254254
FetchOneStatementOptionalProtocolRequest(statement: statement),
255255
database: database
@@ -265,7 +265,7 @@ public struct FetchOne<Value: Sendable>: Sendable {
265265
/// - database: The database to read from. A value of `nil` will use the default database
266266
/// (`@Dependency(\.defaultDatabase)`).
267267
public init(
268-
wrappedValue: Value = .none,
268+
wrappedValue: Value = ._none,
269269
_ statement: some StructuredQueriesCore.Statement<Value>,
270270
database: (any DatabaseReader)? = nil
271271
)
@@ -437,7 +437,7 @@ extension FetchOne {
437437
/// - scheduler: The scheduler to observe from. By default, database observation is performed
438438
/// asynchronously on the main queue.
439439
public init(
440-
wrappedValue: sending Value = .none,
440+
wrappedValue: sending Value = ._none,
441441
database: (any DatabaseReader)? = nil,
442442
scheduler: some ValueObservationScheduler & Hashable
443443
)
@@ -576,7 +576,7 @@ extension FetchOne {
576576
/// - scheduler: The scheduler to observe from. By default, database observation is performed
577577
/// asynchronously on the main queue.
578578
public init<S: SelectStatement>(
579-
wrappedValue: Value = .none,
579+
wrappedValue: Value = ._none,
580580
_ statement: S,
581581
database: (any DatabaseReader)? = nil,
582582
scheduler: some ValueObservationScheduler & Hashable
@@ -590,7 +590,7 @@ extension FetchOne {
590590
{
591591
let statement = statement.selectStar().asSelect().limit(1)
592592
sharedReader = SharedReader(
593-
wrappedValue: .none,
593+
wrappedValue: wrappedValue,
594594
.fetch(
595595
FetchOneStatementOptionalProtocolRequest(statement: statement),
596596
database: database,
@@ -609,7 +609,7 @@ extension FetchOne {
609609
/// - scheduler: The scheduler to observe from. By default, database observation is performed
610610
/// asynchronously on the main queue.
611611
public init<S: StructuredQueriesCore.Statement>(
612-
wrappedValue: Value = .none,
612+
wrappedValue: Value = ._none,
613613
_ statement: S,
614614
database: (any DatabaseReader)? = nil,
615615
scheduler: some ValueObservationScheduler & Hashable
@@ -621,7 +621,7 @@ extension FetchOne {
621621
Value == S.QueryValue.QueryOutput
622622
{
623623
sharedReader = SharedReader(
624-
wrappedValue: .none,
624+
wrappedValue: wrappedValue,
625625
.fetch(
626626
FetchOneStatementOptionalProtocolRequest(statement: statement),
627627
database: database,
@@ -640,7 +640,7 @@ extension FetchOne {
640640
/// - scheduler: The scheduler to observe from. By default, database observation is performed
641641
/// asynchronously on the main queue.
642642
public init(
643-
wrappedValue: Value = .none,
643+
wrappedValue: Value = ._none,
644644
_ statement: some StructuredQueriesCore.Statement<Value>,
645645
database: (any DatabaseReader)? = nil,
646646
scheduler: some ValueObservationScheduler & Hashable
@@ -858,7 +858,7 @@ extension FetchOne: Equatable where Value: Equatable {
858858
/// - animation: The animation to use for user interface changes that result from changes to
859859
/// the fetched results.
860860
public init(
861-
wrappedValue: sending Value = .none,
861+
wrappedValue: sending Value = ._none,
862862
database: (any DatabaseReader)? = nil,
863863
animation: Animation
864864
)
@@ -987,7 +987,7 @@ extension FetchOne: Equatable where Value: Equatable {
987987
/// - animation: The animation to use for user interface changes that result from changes to
988988
/// the fetched results.
989989
public init<S: SelectStatement>(
990-
wrappedValue: Value = .none,
990+
wrappedValue: Value = ._none,
991991
_ statement: S,
992992
database: (any DatabaseReader)? = nil,
993993
animation: Animation
@@ -1017,7 +1017,7 @@ extension FetchOne: Equatable where Value: Equatable {
10171017
/// - animation: The animation to use for user interface changes that result from changes to
10181018
/// the fetched results.
10191019
public init<S: StructuredQueriesCore.Statement>(
1020-
wrappedValue: Value = .none,
1020+
wrappedValue: Value = ._none,
10211021
_ statement: S,
10221022
database: (any DatabaseReader)? = nil,
10231023
animation: Animation
@@ -1046,7 +1046,7 @@ extension FetchOne: Equatable where Value: Equatable {
10461046
/// - animation: The animation to use for user interface changes that result from changes to
10471047
/// the fetched results.
10481048
public init(
1049-
wrappedValue: Value = .none,
1049+
wrappedValue: Value = ._none,
10501050
_ statement: some StructuredQueriesCore.Statement<Value>,
10511051
database: (any DatabaseReader)? = nil,
10521052
animation: Animation
@@ -1217,6 +1217,6 @@ private struct FetchOneStatementOptionalProtocolRequest<
12171217
>: StatementKeyRequest where Value.QueryOutput: _OptionalProtocol {
12181218
let statement: any StructuredQueriesCore.Statement<Value>
12191219
func fetch(_ db: Database) throws -> Value.QueryOutput {
1220-
try statement.fetchOne(db) ?? .none
1220+
try statement.fetchOne(db) ?? ._none
12211221
}
12221222
}

Tests/SharingGRDBTests/FetchOneTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ extension DatabaseWriter where Self == DatabaseQueue {
195195
)
196196
.execute(db)
197197
for _ in 1...3 {
198-
_ = try Record.insert(Record.Draft()).execute(db)
198+
_ = try Record.insert { Record.Draft() }.execute(db)
199199
}
200200
}
201201
return database

Tests/StructuredQueriesGRDBTests/QueryCursorTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import Testing
1818

1919
@Test func emptyInsert() throws {
2020
try database.write { db in
21-
try Number.insert([]).execute(db)
21+
try Number.insert { [] }.execute(db)
2222
}
2323
}
2424

0 commit comments

Comments
 (0)