Skip to content

Commit 2cad52a

Browse files
authored
Remove need to supply PostgresDecodingContext when decoding Rows (#307)
1 parent 17ba80f commit 2cad52a

File tree

4 files changed

+278
-22
lines changed

4 files changed

+278
-22
lines changed

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

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@ extension PostgresRow {
3131
}
3232
}
3333

34+
@inlinable
35+
@_alwaysEmitIntoClient
36+
public func decode<T0: PostgresDecodable>(_: (T0).Type, file: String = #file, line: Int = #line) throws -> (T0) {
37+
try self.decode(T0.self, context: .default, file: file, line: line)
38+
}
39+
3440
@inlinable
3541
@_alwaysEmitIntoClient
3642
public func decode<T0: PostgresDecodable, T1: PostgresDecodable, JSONDecoder: PostgresJSONDecoder>(_: (T0, T1).Type, context: PostgresDecodingContext<JSONDecoder>, file: String = #file, line: Int = #line) throws -> (T0, T1) {
@@ -67,6 +73,12 @@ extension PostgresRow {
6773
}
6874
}
6975

76+
@inlinable
77+
@_alwaysEmitIntoClient
78+
public func decode<T0: PostgresDecodable, T1: PostgresDecodable>(_: (T0, T1).Type, file: String = #file, line: Int = #line) throws -> (T0, T1) {
79+
try self.decode((T0, T1).self, context: .default, file: file, line: line)
80+
}
81+
7082
@inlinable
7183
@_alwaysEmitIntoClient
7284
public func decode<T0: PostgresDecodable, T1: PostgresDecodable, T2: PostgresDecodable, JSONDecoder: PostgresJSONDecoder>(_: (T0, T1, T2).Type, context: PostgresDecodingContext<JSONDecoder>, file: String = #file, line: Int = #line) throws -> (T0, T1, T2) {
@@ -109,6 +121,12 @@ extension PostgresRow {
109121
}
110122
}
111123

124+
@inlinable
125+
@_alwaysEmitIntoClient
126+
public func decode<T0: PostgresDecodable, T1: PostgresDecodable, T2: PostgresDecodable>(_: (T0, T1, T2).Type, file: String = #file, line: Int = #line) throws -> (T0, T1, T2) {
127+
try self.decode((T0, T1, T2).self, context: .default, file: file, line: line)
128+
}
129+
112130
@inlinable
113131
@_alwaysEmitIntoClient
114132
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) throws -> (T0, T1, T2, T3) {
@@ -157,6 +175,12 @@ extension PostgresRow {
157175
}
158176
}
159177

178+
@inlinable
179+
@_alwaysEmitIntoClient
180+
public func decode<T0: PostgresDecodable, T1: PostgresDecodable, T2: PostgresDecodable, T3: PostgresDecodable>(_: (T0, T1, T2, T3).Type, file: String = #file, line: Int = #line) throws -> (T0, T1, T2, T3) {
181+
try self.decode((T0, T1, T2, T3).self, context: .default, file: file, line: line)
182+
}
183+
160184
@inlinable
161185
@_alwaysEmitIntoClient
162186
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) throws -> (T0, T1, T2, T3, T4) {
@@ -211,6 +235,12 @@ extension PostgresRow {
211235
}
212236
}
213237

238+
@inlinable
239+
@_alwaysEmitIntoClient
240+
public func decode<T0: PostgresDecodable, T1: PostgresDecodable, T2: PostgresDecodable, T3: PostgresDecodable, T4: PostgresDecodable>(_: (T0, T1, T2, T3, T4).Type, file: String = #file, line: Int = #line) throws -> (T0, T1, T2, T3, T4) {
241+
try self.decode((T0, T1, T2, T3, T4).self, context: .default, file: file, line: line)
242+
}
243+
214244
@inlinable
215245
@_alwaysEmitIntoClient
216246
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) throws -> (T0, T1, T2, T3, T4, T5) {
@@ -271,6 +301,12 @@ extension PostgresRow {
271301
}
272302
}
273303

304+
@inlinable
305+
@_alwaysEmitIntoClient
306+
public func decode<T0: PostgresDecodable, T1: PostgresDecodable, T2: PostgresDecodable, T3: PostgresDecodable, T4: PostgresDecodable, T5: PostgresDecodable>(_: (T0, T1, T2, T3, T4, T5).Type, file: String = #file, line: Int = #line) throws -> (T0, T1, T2, T3, T4, T5) {
307+
try self.decode((T0, T1, T2, T3, T4, T5).self, context: .default, file: file, line: line)
308+
}
309+
274310
@inlinable
275311
@_alwaysEmitIntoClient
276312
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) throws -> (T0, T1, T2, T3, T4, T5, T6) {
@@ -337,6 +373,12 @@ extension PostgresRow {
337373
}
338374
}
339375

376+
@inlinable
377+
@_alwaysEmitIntoClient
378+
public func decode<T0: PostgresDecodable, T1: PostgresDecodable, T2: PostgresDecodable, T3: PostgresDecodable, T4: PostgresDecodable, T5: PostgresDecodable, T6: PostgresDecodable>(_: (T0, T1, T2, T3, T4, T5, T6).Type, file: String = #file, line: Int = #line) throws -> (T0, T1, T2, T3, T4, T5, T6) {
379+
try self.decode((T0, T1, T2, T3, T4, T5, T6).self, context: .default, file: file, line: line)
380+
}
381+
340382
@inlinable
341383
@_alwaysEmitIntoClient
342384
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) throws -> (T0, T1, T2, T3, T4, T5, T6, T7) {
@@ -409,6 +451,12 @@ extension PostgresRow {
409451
}
410452
}
411453

454+
@inlinable
455+
@_alwaysEmitIntoClient
456+
public func decode<T0: PostgresDecodable, T1: PostgresDecodable, T2: PostgresDecodable, T3: PostgresDecodable, T4: PostgresDecodable, T5: PostgresDecodable, T6: PostgresDecodable, T7: PostgresDecodable>(_: (T0, T1, T2, T3, T4, T5, T6, T7).Type, file: String = #file, line: Int = #line) throws -> (T0, T1, T2, T3, T4, T5, T6, T7) {
457+
try self.decode((T0, T1, T2, T3, T4, T5, T6, T7).self, context: .default, file: file, line: line)
458+
}
459+
412460
@inlinable
413461
@_alwaysEmitIntoClient
414462
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) throws -> (T0, T1, T2, T3, T4, T5, T6, T7, T8) {
@@ -487,6 +535,12 @@ extension PostgresRow {
487535
}
488536
}
489537

538+
@inlinable
539+
@_alwaysEmitIntoClient
540+
public func decode<T0: PostgresDecodable, T1: PostgresDecodable, T2: PostgresDecodable, T3: PostgresDecodable, T4: PostgresDecodable, T5: PostgresDecodable, T6: PostgresDecodable, T7: PostgresDecodable, T8: PostgresDecodable>(_: (T0, T1, T2, T3, T4, T5, T6, T7, T8).Type, file: String = #file, line: Int = #line) throws -> (T0, T1, T2, T3, T4, T5, T6, T7, T8) {
541+
try self.decode((T0, T1, T2, T3, T4, T5, T6, T7, T8).self, context: .default, file: file, line: line)
542+
}
543+
490544
@inlinable
491545
@_alwaysEmitIntoClient
492546
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) throws -> (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9) {
@@ -571,6 +625,12 @@ extension PostgresRow {
571625
}
572626
}
573627

628+
@inlinable
629+
@_alwaysEmitIntoClient
630+
public func decode<T0: PostgresDecodable, T1: PostgresDecodable, T2: PostgresDecodable, T3: PostgresDecodable, T4: PostgresDecodable, T5: PostgresDecodable, T6: PostgresDecodable, T7: PostgresDecodable, T8: PostgresDecodable, T9: PostgresDecodable>(_: (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9).Type, file: String = #file, line: Int = #line) throws -> (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9) {
631+
try self.decode((T0, T1, T2, T3, T4, T5, T6, T7, T8, T9).self, context: .default, file: file, line: line)
632+
}
633+
574634
@inlinable
575635
@_alwaysEmitIntoClient
576636
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) throws -> (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10) {
@@ -661,6 +721,12 @@ extension PostgresRow {
661721
}
662722
}
663723

724+
@inlinable
725+
@_alwaysEmitIntoClient
726+
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>(_: (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10).Type, file: String = #file, line: Int = #line) throws -> (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10) {
727+
try self.decode((T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10).self, context: .default, file: file, line: line)
728+
}
729+
664730
@inlinable
665731
@_alwaysEmitIntoClient
666732
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) throws -> (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11) {
@@ -757,6 +823,12 @@ extension PostgresRow {
757823
}
758824
}
759825

826+
@inlinable
827+
@_alwaysEmitIntoClient
828+
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>(_: (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11).Type, file: String = #file, line: Int = #line) throws -> (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11) {
829+
try self.decode((T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11).self, context: .default, file: file, line: line)
830+
}
831+
760832
@inlinable
761833
@_alwaysEmitIntoClient
762834
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) throws -> (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12) {
@@ -859,6 +931,12 @@ extension PostgresRow {
859931
}
860932
}
861933

934+
@inlinable
935+
@_alwaysEmitIntoClient
936+
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>(_: (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12).Type, file: String = #file, line: Int = #line) throws -> (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12) {
937+
try self.decode((T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12).self, context: .default, file: file, line: line)
938+
}
939+
862940
@inlinable
863941
@_alwaysEmitIntoClient
864942
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) throws -> (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13) {
@@ -967,6 +1045,12 @@ extension PostgresRow {
9671045
}
9681046
}
9691047

1048+
@inlinable
1049+
@_alwaysEmitIntoClient
1050+
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>(_: (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13).Type, file: String = #file, line: Int = #line) throws -> (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13) {
1051+
try self.decode((T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13).self, context: .default, file: file, line: line)
1052+
}
1053+
9701054
@inlinable
9711055
@_alwaysEmitIntoClient
9721056
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) throws -> (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14) {
@@ -1080,4 +1164,10 @@ extension PostgresRow {
10801164
)
10811165
}
10821166
}
1167+
1168+
@inlinable
1169+
@_alwaysEmitIntoClient
1170+
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>(_: (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14).Type, file: String = #file, line: Int = #line) throws -> (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14) {
1171+
try self.decode((T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14).self, context: .default, file: file, line: line)
1172+
}
10831173
}

0 commit comments

Comments
 (0)