Skip to content

Commit f7f388b

Browse files
More flexible sendability (#118)
* Drop sendable requirements. * wip --------- Co-authored-by: Brandon Williams <[email protected]>
1 parent 5b23ef4 commit f7f388b

File tree

4 files changed

+24
-9
lines changed

4 files changed

+24
-9
lines changed

Sources/SharingGRDBCore/FetchAll.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,10 @@ extension FetchAll: Equatable where Element: Equatable {
511511
#endif
512512

513513
private struct FetchAllStatementValueRequest<Value: QueryRepresentable>: StatementKeyRequest {
514-
let statement: any StructuredQueriesCore.Statement<Value>
514+
let statement: SQLQueryExpression<Value>
515+
init(statement: some StructuredQueriesCore.Statement<Value>) {
516+
self.statement = SQLQueryExpression(statement)
517+
}
515518
func fetch(_ db: Database) throws -> [Value.QueryOutput] {
516519
try statement.fetchAll(db)
517520
}

Sources/SharingGRDBCore/FetchOne.swift

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1201,9 +1201,9 @@ extension FetchOne: Equatable where Value: Equatable {
12011201
#endif
12021202

12031203
private struct FetchOneStatementValueRequest<Value: QueryRepresentable>: StatementKeyRequest {
1204-
let statement: any StructuredQueriesCore.Statement<Value>
1205-
init(statement: any StructuredQueriesCore.Statement<Value>) {
1206-
self.statement = statement
1204+
let statement: SQLQueryExpression<Value>
1205+
init(statement: some StructuredQueriesCore.Statement<Value>) {
1206+
self.statement = SQLQueryExpression(statement)
12071207
}
12081208
func fetch(_ db: Database) throws -> Value.QueryOutput {
12091209
guard let result = try statement.fetchOne(db)
@@ -1215,7 +1215,10 @@ private struct FetchOneStatementValueRequest<Value: QueryRepresentable>: Stateme
12151215
private struct FetchOneStatementOptionalValueRequest<Value: QueryRepresentable>:
12161216
StatementKeyRequest
12171217
{
1218-
let statement: any StructuredQueriesCore.Statement<Value>
1218+
let statement: SQLQueryExpression<Value>
1219+
init(statement: some StructuredQueriesCore.Statement<Value>) {
1220+
self.statement = SQLQueryExpression(statement)
1221+
}
12191222
func fetch(_ db: Database) throws -> Value.QueryOutput? {
12201223
try statement.fetchOne(db)
12211224
}
@@ -1224,7 +1227,10 @@ private struct FetchOneStatementOptionalValueRequest<Value: QueryRepresentable>:
12241227
private struct FetchOneStatementOptionalProtocolRequest<
12251228
Value: QueryRepresentable & _OptionalProtocol
12261229
>: StatementKeyRequest where Value.QueryOutput: _OptionalProtocol {
1227-
let statement: any StructuredQueriesCore.Statement<Value>
1230+
let statement: SQLQueryExpression<Value>
1231+
init(statement: some StructuredQueriesCore.Statement<Value>) {
1232+
self.statement = SQLQueryExpression(statement)
1233+
}
12281234
func fetch(_ db: Database) throws -> Value.QueryOutput {
12291235
try statement.fetchOne(db) ?? ._none
12301236
}

Sources/SharingGRDBCore/Internal/Deprecations.swift

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,10 @@ extension FetchAll {
277277

278278
@available(iOS 17, macOS 14, tvOS 17, watchOS 10, *)
279279
private struct FetchAllStatementPackRequest<each Value: QueryRepresentable>: StatementKeyRequest {
280-
let statement: any StructuredQueriesCore.Statement<(repeat each Value)>
280+
let statement: SQLQueryExpression<(repeat each Value)>
281+
init(statement: some StructuredQueriesCore.Statement<(repeat each Value)>) {
282+
self.statement = SQLQueryExpression(statement)
283+
}
281284
func fetch(_ db: Database) throws -> [(repeat (each Value).QueryOutput)] {
282285
try statement.fetchAll(db)
283286
}
@@ -540,7 +543,10 @@ extension FetchOne {
540543

541544
@available(iOS 17, macOS 14, tvOS 17, watchOS 10, *)
542545
private struct FetchOneStatementPackRequest<each Value: QueryRepresentable>: StatementKeyRequest {
543-
let statement: any StructuredQueriesCore.Statement<(repeat each Value)>
546+
let statement: SQLQueryExpression<(repeat each Value)>
547+
init(statement: some StructuredQueriesCore.Statement<(repeat each Value)>) {
548+
self.statement = SQLQueryExpression(statement)
549+
}
544550
func fetch(_ db: Database) throws -> (repeat (each Value).QueryOutput) {
545551
guard let result = try statement.fetchOne(db)
546552
else { throw NotFound() }

Sources/SharingGRDBCore/Internal/StatementKey.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
protocol StatementKeyRequest<QueryValue>: FetchKeyRequest {
22
associatedtype QueryValue
3-
var statement: any StructuredQueriesCore.Statement<QueryValue> { get }
3+
var statement: SQLQueryExpression<QueryValue> { get }
44
}
55

66
extension StatementKeyRequest {

0 commit comments

Comments
 (0)