Skip to content

Commit 136cf4c

Browse files
authored
Make PostgresRowSequence public (#247)
1 parent ba0d2bb commit 136cf4c

File tree

5 files changed

+60
-31
lines changed

5 files changed

+60
-31
lines changed

Sources/PostgresNIO/New/PostgresRowSequence-multi-decode.swift

Lines changed: 45 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,91 +2,121 @@
22

33
#if swift(>=5.5) && canImport(_Concurrency)
44
extension PostgresRowSequence {
5-
func decode<T0: PostgresDecodable, JSONDecoder: PostgresJSONDecoder>(_: (T0).Type, context: PostgresDecodingContext<JSONDecoder>, file: String = #file, line: Int = #line) -> AsyncThrowingMapSequence<PostgresRowSequence, (T0)> {
5+
@inlinable
6+
@_alwaysEmitIntoClient
7+
public func decode<T0: PostgresDecodable, JSONDecoder: PostgresJSONDecoder>(_: (T0).Type, context: PostgresDecodingContext<JSONDecoder>, file: String = #file, line: Int = #line) -> AsyncThrowingMapSequence<PostgresRowSequence, (T0)> {
68
self.map { row in
79
try row.decode(T0.self, context: context, file: file, line: line)
810
}
911
}
1012

11-
func decode<T0: PostgresDecodable, T1: PostgresDecodable, JSONDecoder: PostgresJSONDecoder>(_: (T0, T1).Type, context: PostgresDecodingContext<JSONDecoder>, file: String = #file, line: Int = #line) -> AsyncThrowingMapSequence<PostgresRowSequence, (T0, T1)> {
13+
@inlinable
14+
@_alwaysEmitIntoClient
15+
public func decode<T0: PostgresDecodable, T1: PostgresDecodable, JSONDecoder: PostgresJSONDecoder>(_: (T0, T1).Type, context: PostgresDecodingContext<JSONDecoder>, file: String = #file, line: Int = #line) -> AsyncThrowingMapSequence<PostgresRowSequence, (T0, T1)> {
1216
self.map { row in
1317
try row.decode((T0, T1).self, context: context, file: file, line: line)
1418
}
1519
}
1620

17-
func decode<T0: PostgresDecodable, T1: PostgresDecodable, T2: PostgresDecodable, JSONDecoder: PostgresJSONDecoder>(_: (T0, T1, T2).Type, context: PostgresDecodingContext<JSONDecoder>, file: String = #file, line: Int = #line) -> AsyncThrowingMapSequence<PostgresRowSequence, (T0, T1, T2)> {
21+
@inlinable
22+
@_alwaysEmitIntoClient
23+
public func decode<T0: PostgresDecodable, T1: PostgresDecodable, T2: PostgresDecodable, JSONDecoder: PostgresJSONDecoder>(_: (T0, T1, T2).Type, context: PostgresDecodingContext<JSONDecoder>, file: String = #file, line: Int = #line) -> AsyncThrowingMapSequence<PostgresRowSequence, (T0, T1, T2)> {
1824
self.map { row in
1925
try row.decode((T0, T1, T2).self, context: context, file: file, line: line)
2026
}
2127
}
2228

23-
func decode<T0: PostgresDecodable, T1: PostgresDecodable, T2: PostgresDecodable, T3: PostgresDecodable, JSONDecoder: PostgresJSONDecoder>(_: (T0, T1, T2, T3).Type, context: PostgresDecodingContext<JSONDecoder>, file: String = #file, line: Int = #line) -> AsyncThrowingMapSequence<PostgresRowSequence, (T0, T1, T2, T3)> {
29+
@inlinable
30+
@_alwaysEmitIntoClient
31+
public func decode<T0: PostgresDecodable, T1: PostgresDecodable, T2: PostgresDecodable, T3: PostgresDecodable, JSONDecoder: PostgresJSONDecoder>(_: (T0, T1, T2, T3).Type, context: PostgresDecodingContext<JSONDecoder>, file: String = #file, line: Int = #line) -> AsyncThrowingMapSequence<PostgresRowSequence, (T0, T1, T2, T3)> {
2432
self.map { row in
2533
try row.decode((T0, T1, T2, T3).self, context: context, file: file, line: line)
2634
}
2735
}
2836

29-
func decode<T0: PostgresDecodable, T1: PostgresDecodable, T2: PostgresDecodable, T3: PostgresDecodable, T4: PostgresDecodable, JSONDecoder: PostgresJSONDecoder>(_: (T0, T1, T2, T3, T4).Type, context: PostgresDecodingContext<JSONDecoder>, file: String = #file, line: Int = #line) -> AsyncThrowingMapSequence<PostgresRowSequence, (T0, T1, T2, T3, T4)> {
37+
@inlinable
38+
@_alwaysEmitIntoClient
39+
public func decode<T0: PostgresDecodable, T1: PostgresDecodable, T2: PostgresDecodable, T3: PostgresDecodable, T4: PostgresDecodable, JSONDecoder: PostgresJSONDecoder>(_: (T0, T1, T2, T3, T4).Type, context: PostgresDecodingContext<JSONDecoder>, file: String = #file, line: Int = #line) -> AsyncThrowingMapSequence<PostgresRowSequence, (T0, T1, T2, T3, T4)> {
3040
self.map { row in
3141
try row.decode((T0, T1, T2, T3, T4).self, context: context, file: file, line: line)
3242
}
3343
}
3444

35-
func decode<T0: PostgresDecodable, T1: PostgresDecodable, T2: PostgresDecodable, T3: PostgresDecodable, T4: PostgresDecodable, T5: PostgresDecodable, JSONDecoder: PostgresJSONDecoder>(_: (T0, T1, T2, T3, T4, T5).Type, context: PostgresDecodingContext<JSONDecoder>, file: String = #file, line: Int = #line) -> AsyncThrowingMapSequence<PostgresRowSequence, (T0, T1, T2, T3, T4, T5)> {
45+
@inlinable
46+
@_alwaysEmitIntoClient
47+
public func decode<T0: PostgresDecodable, T1: PostgresDecodable, T2: PostgresDecodable, T3: PostgresDecodable, T4: PostgresDecodable, T5: PostgresDecodable, JSONDecoder: PostgresJSONDecoder>(_: (T0, T1, T2, T3, T4, T5).Type, context: PostgresDecodingContext<JSONDecoder>, file: String = #file, line: Int = #line) -> AsyncThrowingMapSequence<PostgresRowSequence, (T0, T1, T2, T3, T4, T5)> {
3648
self.map { row in
3749
try row.decode((T0, T1, T2, T3, T4, T5).self, context: context, file: file, line: line)
3850
}
3951
}
4052

41-
func decode<T0: PostgresDecodable, T1: PostgresDecodable, T2: PostgresDecodable, T3: PostgresDecodable, T4: PostgresDecodable, T5: PostgresDecodable, T6: PostgresDecodable, JSONDecoder: PostgresJSONDecoder>(_: (T0, T1, T2, T3, T4, T5, T6).Type, context: PostgresDecodingContext<JSONDecoder>, file: String = #file, line: Int = #line) -> AsyncThrowingMapSequence<PostgresRowSequence, (T0, T1, T2, T3, T4, T5, T6)> {
53+
@inlinable
54+
@_alwaysEmitIntoClient
55+
public func decode<T0: PostgresDecodable, T1: PostgresDecodable, T2: PostgresDecodable, T3: PostgresDecodable, T4: PostgresDecodable, T5: PostgresDecodable, T6: PostgresDecodable, JSONDecoder: PostgresJSONDecoder>(_: (T0, T1, T2, T3, T4, T5, T6).Type, context: PostgresDecodingContext<JSONDecoder>, file: String = #file, line: Int = #line) -> AsyncThrowingMapSequence<PostgresRowSequence, (T0, T1, T2, T3, T4, T5, T6)> {
4256
self.map { row in
4357
try row.decode((T0, T1, T2, T3, T4, T5, T6).self, context: context, file: file, line: line)
4458
}
4559
}
4660

47-
func decode<T0: PostgresDecodable, T1: PostgresDecodable, T2: PostgresDecodable, T3: PostgresDecodable, T4: PostgresDecodable, T5: PostgresDecodable, T6: PostgresDecodable, T7: PostgresDecodable, JSONDecoder: PostgresJSONDecoder>(_: (T0, T1, T2, T3, T4, T5, T6, T7).Type, context: PostgresDecodingContext<JSONDecoder>, file: String = #file, line: Int = #line) -> AsyncThrowingMapSequence<PostgresRowSequence, (T0, T1, T2, T3, T4, T5, T6, T7)> {
61+
@inlinable
62+
@_alwaysEmitIntoClient
63+
public func decode<T0: PostgresDecodable, T1: PostgresDecodable, T2: PostgresDecodable, T3: PostgresDecodable, T4: PostgresDecodable, T5: PostgresDecodable, T6: PostgresDecodable, T7: PostgresDecodable, JSONDecoder: PostgresJSONDecoder>(_: (T0, T1, T2, T3, T4, T5, T6, T7).Type, context: PostgresDecodingContext<JSONDecoder>, file: String = #file, line: Int = #line) -> AsyncThrowingMapSequence<PostgresRowSequence, (T0, T1, T2, T3, T4, T5, T6, T7)> {
4864
self.map { row in
4965
try row.decode((T0, T1, T2, T3, T4, T5, T6, T7).self, context: context, file: file, line: line)
5066
}
5167
}
5268

53-
func decode<T0: PostgresDecodable, T1: PostgresDecodable, T2: PostgresDecodable, T3: PostgresDecodable, T4: PostgresDecodable, T5: PostgresDecodable, T6: PostgresDecodable, T7: PostgresDecodable, T8: PostgresDecodable, JSONDecoder: PostgresJSONDecoder>(_: (T0, T1, T2, T3, T4, T5, T6, T7, T8).Type, context: PostgresDecodingContext<JSONDecoder>, file: String = #file, line: Int = #line) -> AsyncThrowingMapSequence<PostgresRowSequence, (T0, T1, T2, T3, T4, T5, T6, T7, T8)> {
69+
@inlinable
70+
@_alwaysEmitIntoClient
71+
public func decode<T0: PostgresDecodable, T1: PostgresDecodable, T2: PostgresDecodable, T3: PostgresDecodable, T4: PostgresDecodable, T5: PostgresDecodable, T6: PostgresDecodable, T7: PostgresDecodable, T8: PostgresDecodable, JSONDecoder: PostgresJSONDecoder>(_: (T0, T1, T2, T3, T4, T5, T6, T7, T8).Type, context: PostgresDecodingContext<JSONDecoder>, file: String = #file, line: Int = #line) -> AsyncThrowingMapSequence<PostgresRowSequence, (T0, T1, T2, T3, T4, T5, T6, T7, T8)> {
5472
self.map { row in
5573
try row.decode((T0, T1, T2, T3, T4, T5, T6, T7, T8).self, context: context, file: file, line: line)
5674
}
5775
}
5876

59-
func decode<T0: PostgresDecodable, T1: PostgresDecodable, T2: PostgresDecodable, T3: PostgresDecodable, T4: PostgresDecodable, T5: PostgresDecodable, T6: PostgresDecodable, T7: PostgresDecodable, T8: PostgresDecodable, T9: PostgresDecodable, JSONDecoder: PostgresJSONDecoder>(_: (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9).Type, context: PostgresDecodingContext<JSONDecoder>, file: String = #file, line: Int = #line) -> AsyncThrowingMapSequence<PostgresRowSequence, (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9)> {
77+
@inlinable
78+
@_alwaysEmitIntoClient
79+
public func decode<T0: PostgresDecodable, T1: PostgresDecodable, T2: PostgresDecodable, T3: PostgresDecodable, T4: PostgresDecodable, T5: PostgresDecodable, T6: PostgresDecodable, T7: PostgresDecodable, T8: PostgresDecodable, T9: PostgresDecodable, JSONDecoder: PostgresJSONDecoder>(_: (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9).Type, context: PostgresDecodingContext<JSONDecoder>, file: String = #file, line: Int = #line) -> AsyncThrowingMapSequence<PostgresRowSequence, (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9)> {
6080
self.map { row in
6181
try row.decode((T0, T1, T2, T3, T4, T5, T6, T7, T8, T9).self, context: context, file: file, line: line)
6282
}
6383
}
6484

65-
func decode<T0: PostgresDecodable, T1: PostgresDecodable, T2: PostgresDecodable, T3: PostgresDecodable, T4: PostgresDecodable, T5: PostgresDecodable, T6: PostgresDecodable, T7: PostgresDecodable, T8: PostgresDecodable, T9: PostgresDecodable, T10: PostgresDecodable, JSONDecoder: PostgresJSONDecoder>(_: (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10).Type, context: PostgresDecodingContext<JSONDecoder>, file: String = #file, line: Int = #line) -> AsyncThrowingMapSequence<PostgresRowSequence, (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10)> {
85+
@inlinable
86+
@_alwaysEmitIntoClient
87+
public func decode<T0: PostgresDecodable, T1: PostgresDecodable, T2: PostgresDecodable, T3: PostgresDecodable, T4: PostgresDecodable, T5: PostgresDecodable, T6: PostgresDecodable, T7: PostgresDecodable, T8: PostgresDecodable, T9: PostgresDecodable, T10: PostgresDecodable, JSONDecoder: PostgresJSONDecoder>(_: (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10).Type, context: PostgresDecodingContext<JSONDecoder>, file: String = #file, line: Int = #line) -> AsyncThrowingMapSequence<PostgresRowSequence, (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10)> {
6688
self.map { row in
6789
try row.decode((T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10).self, context: context, file: file, line: line)
6890
}
6991
}
7092

71-
func decode<T0: PostgresDecodable, T1: PostgresDecodable, T2: PostgresDecodable, T3: PostgresDecodable, T4: PostgresDecodable, T5: PostgresDecodable, T6: PostgresDecodable, T7: PostgresDecodable, T8: PostgresDecodable, T9: PostgresDecodable, T10: PostgresDecodable, T11: PostgresDecodable, JSONDecoder: PostgresJSONDecoder>(_: (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11).Type, context: PostgresDecodingContext<JSONDecoder>, file: String = #file, line: Int = #line) -> AsyncThrowingMapSequence<PostgresRowSequence, (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11)> {
93+
@inlinable
94+
@_alwaysEmitIntoClient
95+
public func decode<T0: PostgresDecodable, T1: PostgresDecodable, T2: PostgresDecodable, T3: PostgresDecodable, T4: PostgresDecodable, T5: PostgresDecodable, T6: PostgresDecodable, T7: PostgresDecodable, T8: PostgresDecodable, T9: PostgresDecodable, T10: PostgresDecodable, T11: PostgresDecodable, JSONDecoder: PostgresJSONDecoder>(_: (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11).Type, context: PostgresDecodingContext<JSONDecoder>, file: String = #file, line: Int = #line) -> AsyncThrowingMapSequence<PostgresRowSequence, (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11)> {
7296
self.map { row in
7397
try row.decode((T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11).self, context: context, file: file, line: line)
7498
}
7599
}
76100

77-
func decode<T0: PostgresDecodable, T1: PostgresDecodable, T2: PostgresDecodable, T3: PostgresDecodable, T4: PostgresDecodable, T5: PostgresDecodable, T6: PostgresDecodable, T7: PostgresDecodable, T8: PostgresDecodable, T9: PostgresDecodable, T10: PostgresDecodable, T11: PostgresDecodable, T12: PostgresDecodable, JSONDecoder: PostgresJSONDecoder>(_: (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12).Type, context: PostgresDecodingContext<JSONDecoder>, file: String = #file, line: Int = #line) -> AsyncThrowingMapSequence<PostgresRowSequence, (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12)> {
101+
@inlinable
102+
@_alwaysEmitIntoClient
103+
public func decode<T0: PostgresDecodable, T1: PostgresDecodable, T2: PostgresDecodable, T3: PostgresDecodable, T4: PostgresDecodable, T5: PostgresDecodable, T6: PostgresDecodable, T7: PostgresDecodable, T8: PostgresDecodable, T9: PostgresDecodable, T10: PostgresDecodable, T11: PostgresDecodable, T12: PostgresDecodable, JSONDecoder: PostgresJSONDecoder>(_: (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12).Type, context: PostgresDecodingContext<JSONDecoder>, file: String = #file, line: Int = #line) -> AsyncThrowingMapSequence<PostgresRowSequence, (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12)> {
78104
self.map { row in
79105
try row.decode((T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12).self, context: context, file: file, line: line)
80106
}
81107
}
82108

83-
func decode<T0: PostgresDecodable, T1: PostgresDecodable, T2: PostgresDecodable, T3: PostgresDecodable, T4: PostgresDecodable, T5: PostgresDecodable, T6: PostgresDecodable, T7: PostgresDecodable, T8: PostgresDecodable, T9: PostgresDecodable, T10: PostgresDecodable, T11: PostgresDecodable, T12: PostgresDecodable, T13: PostgresDecodable, JSONDecoder: PostgresJSONDecoder>(_: (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13).Type, context: PostgresDecodingContext<JSONDecoder>, file: String = #file, line: Int = #line) -> AsyncThrowingMapSequence<PostgresRowSequence, (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13)> {
109+
@inlinable
110+
@_alwaysEmitIntoClient
111+
public func decode<T0: PostgresDecodable, T1: PostgresDecodable, T2: PostgresDecodable, T3: PostgresDecodable, T4: PostgresDecodable, T5: PostgresDecodable, T6: PostgresDecodable, T7: PostgresDecodable, T8: PostgresDecodable, T9: PostgresDecodable, T10: PostgresDecodable, T11: PostgresDecodable, T12: PostgresDecodable, T13: PostgresDecodable, JSONDecoder: PostgresJSONDecoder>(_: (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13).Type, context: PostgresDecodingContext<JSONDecoder>, file: String = #file, line: Int = #line) -> AsyncThrowingMapSequence<PostgresRowSequence, (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13)> {
84112
self.map { row in
85113
try row.decode((T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13).self, context: context, file: file, line: line)
86114
}
87115
}
88116

89-
func decode<T0: PostgresDecodable, T1: PostgresDecodable, T2: PostgresDecodable, T3: PostgresDecodable, T4: PostgresDecodable, T5: PostgresDecodable, T6: PostgresDecodable, T7: PostgresDecodable, T8: PostgresDecodable, T9: PostgresDecodable, T10: PostgresDecodable, T11: PostgresDecodable, T12: PostgresDecodable, T13: PostgresDecodable, T14: PostgresDecodable, JSONDecoder: PostgresJSONDecoder>(_: (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14).Type, context: PostgresDecodingContext<JSONDecoder>, file: String = #file, line: Int = #line) -> AsyncThrowingMapSequence<PostgresRowSequence, (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14)> {
117+
@inlinable
118+
@_alwaysEmitIntoClient
119+
public func decode<T0: PostgresDecodable, T1: PostgresDecodable, T2: PostgresDecodable, T3: PostgresDecodable, T4: PostgresDecodable, T5: PostgresDecodable, T6: PostgresDecodable, T7: PostgresDecodable, T8: PostgresDecodable, T9: PostgresDecodable, T10: PostgresDecodable, T11: PostgresDecodable, T12: PostgresDecodable, T13: PostgresDecodable, T14: PostgresDecodable, JSONDecoder: PostgresJSONDecoder>(_: (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14).Type, context: PostgresDecodingContext<JSONDecoder>, file: String = #file, line: Int = #line) -> AsyncThrowingMapSequence<PostgresRowSequence, (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14)> {
90120
self.map { row in
91121
try row.decode((T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14).self, context: context, file: file, line: line)
92122
}

Sources/PostgresNIO/New/PostgresRowSequence.swift

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,8 @@ import NIOConcurrencyHelpers
55
/// An async sequence of ``PostgresRow``s.
66
///
77
/// - Note: This is a struct to allow us to move to a move only type easily once they become available.
8-
struct PostgresRowSequence: AsyncSequence {
9-
typealias Element = PostgresRow
10-
typealias AsyncIterator = Iterator
8+
public struct PostgresRowSequence: AsyncSequence {
9+
public typealias Element = PostgresRow
1110

1211
final class _Internal {
1312

@@ -22,7 +21,7 @@ struct PostgresRowSequence: AsyncSequence {
2221
self.consumer.sequenceDeinitialized()
2322
}
2423

25-
func makeAsyncIterator() -> Iterator {
24+
func makeAsyncIterator() -> AsyncIterator {
2625
self.consumer.makeAsyncIterator()
2726
}
2827
}
@@ -33,22 +32,22 @@ struct PostgresRowSequence: AsyncSequence {
3332
self._internal = .init(consumer: consumer)
3433
}
3534

36-
func makeAsyncIterator() -> Iterator {
35+
public func makeAsyncIterator() -> AsyncIterator {
3736
self._internal.makeAsyncIterator()
3837
}
3938
}
4039

4140
extension PostgresRowSequence {
42-
struct Iterator: AsyncIteratorProtocol {
43-
typealias Element = PostgresRow
41+
public struct AsyncIterator: AsyncIteratorProtocol {
42+
public typealias Element = PostgresRow
4443

4544
let _internal: _Internal
4645

4746
init(consumer: AsyncStreamConsumer) {
4847
self._internal = _Internal(consumer: consumer)
4948
}
5049

51-
mutating func next() async throws -> PostgresRow? {
50+
public mutating func next() async throws -> PostgresRow? {
5251
try await self._internal.next()
5352
}
5453

@@ -155,11 +154,11 @@ final class AsyncStreamConsumer {
155154
}
156155
}
157156

158-
func makeAsyncIterator() -> PostgresRowSequence.Iterator {
157+
func makeAsyncIterator() -> PostgresRowSequence.AsyncIterator {
159158
self.lock.withLock {
160159
self.state.createAsyncIterator()
161160
}
162-
let iterator = PostgresRowSequence.Iterator(consumer: self)
161+
let iterator = PostgresRowSequence.AsyncIterator(consumer: self)
163162
return iterator
164163
}
165164

Tests/IntegrationTests/AsyncTests.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ final class AsyncPostgresConnectionTests: XCTestCase {
3333
try await withTestConnection(on: eventLoop) { connection in
3434
let rows = try await connection.query("SELECT generate_series(\(start), \(end));", logger: .psqlTest)
3535
var counter = 1
36-
for try await row in rows {
37-
XCTAssertEqual(try row.decode(Int.self, context: .default), counter)
36+
for try await element in rows.decode(Int.self, context: .default) {
37+
XCTAssertEqual(element, counter)
3838
counter += 1
3939
}
4040

Tests/PostgresNIOTests/New/PostgresRowSequenceTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ final class PostgresRowSequenceTests: XCTestCase {
9090
let dataRows: [DataRow] = (0..<128).map { [ByteBuffer(integer: Int64($0))] }
9191
stream.receive(dataRows)
9292

93-
var iterator: PostgresRowSequence.Iterator? = rowSequence.makeAsyncIterator()
93+
var iterator: PostgresRowSequence.AsyncIterator? = rowSequence.makeAsyncIterator()
9494
iterator = nil
9595

9696
XCTAssertEqual(dataSource.cancelCount, 1)

dev/generate-postgresrowsequence-multi-decode.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ function gen() {
1111
echo ""
1212
fi
1313

14-
#echo " @inlinable"
15-
#echo " @_alwaysEmitIntoClient"
16-
echo -n " func decode<T0: PostgresDecodable"
14+
echo " @inlinable"
15+
echo " @_alwaysEmitIntoClient"
16+
echo -n " public func decode<T0: PostgresDecodable"
1717
for ((n = 1; n<$how_many; n +=1)); do
1818
echo -n ", T$(($n)): PostgresDecodable"
1919
done

0 commit comments

Comments
 (0)