Skip to content

Commit c996d62

Browse files
authored
Deprecating PostgresDataConvertible, PostgresMessageType (#313)
1 parent 606c68a commit c996d62

31 files changed

+201
-123
lines changed

Sources/PostgresNIO/Data/PostgresData+Array.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import NIOCore
22

33
extension PostgresData {
4-
public init<T>(array: [T])
5-
where T: PostgresDataConvertible
6-
{
4+
@available(*, deprecated, message: "Use ``PostgresQuery`` and ``PostgresBindings`` instead.")
5+
public init<T>(array: [T]) where T: PostgresDataConvertible {
76
self.init(
87
array: array.map { $0.postgresData },
98
elementType: T.postgresDataType
109
)
1110
}
11+
1212
public init(array: [PostgresData?], elementType: PostgresDataType) {
1313
var buffer = ByteBufferAllocator().buffer(capacity: 0)
1414
// 0 if empty, 1 if not
@@ -46,9 +46,8 @@ extension PostgresData {
4646
)
4747
}
4848

49-
public func array<T>(of type: T.Type = T.self) -> [T]?
50-
where T: PostgresDataConvertible
51-
{
49+
@available(*, deprecated, message: "Use ``PostgresRow`` and ``PostgresDecodable`` instead.")
50+
public func array<T>(of type: T.Type = T.self) -> [T]? where T: PostgresDataConvertible {
5251
guard let array = self.array else {
5352
return nil
5453
}
@@ -114,6 +113,7 @@ extension PostgresData {
114113
}
115114
}
116115

116+
@available(*, deprecated, message: "Deprecating conformance to `PostgresDataConvertible`, since it is deprecated.")
117117
extension Array: PostgresDataConvertible where Element: PostgresDataConvertible {
118118
public static var postgresDataType: PostgresDataType {
119119
guard let arrayType = Element.postgresDataType.arrayType else {

Sources/PostgresNIO/Data/PostgresData+Bool.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ extension PostgresData: ExpressibleByBooleanLiteral {
4747
}
4848
}
4949

50+
@available(*, deprecated, message: "Deprecating conformance to `PostgresDataConvertible`, since it is deprecated.")
5051
extension Bool: PostgresDataConvertible {
5152
public static var postgresDataType: PostgresDataType {
5253
return .bool

Sources/PostgresNIO/Data/PostgresData+Bytes.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ extension PostgresData {
2121
}
2222
}
2323

24+
@available(*, deprecated, message: "Deprecating conformance to `PostgresDataConvertible`, since it is deprecated.")
2425
extension Data: PostgresDataConvertible {
2526
public static var postgresDataType: PostgresDataType {
2627
return .bytea

Sources/PostgresNIO/Data/PostgresData+Date.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ extension PostgresData {
3636
}
3737
}
3838

39+
@available(*, deprecated, message: "Deprecating conformance to `PostgresDataConvertible`, since it is deprecated.")
3940
extension Date: PostgresDataConvertible {
4041
public static var postgresDataType: PostgresDataType {
4142
return .timestamptz

Sources/PostgresNIO/Data/PostgresData+Decimal.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ extension PostgresData {
1616
}
1717
}
1818

19+
@available(*, deprecated, message: "Deprecating conformance to `PostgresDataConvertible`, since it is deprecated.")
1920
extension Decimal: PostgresDataConvertible {
2021
public static var postgresDataType: PostgresDataType {
2122
return .numeric

Sources/PostgresNIO/Data/PostgresData+Double.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ extension PostgresData {
3434
}
3535
}
3636

37+
@available(*, deprecated, message: "Deprecating conformance to `PostgresDataConvertible`, since it is deprecated.")
3738
extension Double: PostgresDataConvertible {
3839
public static var postgresDataType: PostgresDataType {
3940
return .float8

Sources/PostgresNIO/Data/PostgresData+Float.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ extension PostgresData {
2828
}
2929
}
3030

31+
@available(*, deprecated, message: "Deprecating conformance to `PostgresDataConvertible`, since it is deprecated.")
3132
extension Float: PostgresDataConvertible {
3233
public static var postgresDataType: PostgresDataType {
3334
return .float4

Sources/PostgresNIO/Data/PostgresData+Int.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@ extension PostgresData {
183183
}
184184
}
185185

186+
@available(*, deprecated, message: "Deprecating conformance to `PostgresDataConvertible`, since it is deprecated.")
186187
extension Int: PostgresDataConvertible {
187188
public static var postgresDataType: PostgresDataType { .int8 }
188189

@@ -198,6 +199,7 @@ extension Int: PostgresDataConvertible {
198199
}
199200
}
200201

202+
@available(*, deprecated, message: "Deprecating conformance to `PostgresDataConvertible`, since it is deprecated.")
201203
extension UInt8: PostgresDataConvertible {
202204
public static var postgresDataType: PostgresDataType { .char }
203205

@@ -213,6 +215,7 @@ extension UInt8: PostgresDataConvertible {
213215
}
214216
}
215217

218+
@available(*, deprecated, message: "Deprecating conformance to `PostgresDataConvertible`, since it is deprecated.")
216219
extension Int16: PostgresDataConvertible {
217220
public static var postgresDataType: PostgresDataType { .int2 }
218221

@@ -228,6 +231,7 @@ extension Int16: PostgresDataConvertible {
228231
}
229232
}
230233

234+
@available(*, deprecated, message: "Deprecating conformance to `PostgresDataConvertible`, since it is deprecated.")
231235
extension Int32: PostgresDataConvertible {
232236
public static var postgresDataType: PostgresDataType { .int4 }
233237

@@ -243,6 +247,7 @@ extension Int32: PostgresDataConvertible {
243247
}
244248
}
245249

250+
@available(*, deprecated, message: "Deprecating conformance to `PostgresDataConvertible`, since it is deprecated.")
246251
extension Int64: PostgresDataConvertible {
247252
public static var postgresDataType: PostgresDataType { .int8 }
248253

Sources/PostgresNIO/Data/PostgresData+JSON.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,10 @@ extension PostgresData {
3737
}
3838
}
3939

40+
@available(*, deprecated, message: "This protocol is going to be replaced with ``PostgresEncodable`` and ``PostgresDecodable`` and conforming to ``Codable`` at the same time")
4041
public protocol PostgresJSONCodable: Codable, PostgresDataConvertible { }
4142

43+
@available(*, deprecated, message: "Deprecating conformance to `PostgresDataConvertible`, since it is deprecated.")
4244
extension PostgresJSONCodable {
4345
public static var postgresDataType: PostgresDataType {
4446
return .json

Sources/PostgresNIO/Data/PostgresData+JSONB.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,10 @@ extension PostgresData {
4848
}
4949
}
5050

51+
@available(*, deprecated, message: "This protocol is going to be replaced with ``PostgresEncodable`` and ``PostgresDecodable`` and conforming to ``Codable`` at the same time")
5152
public protocol PostgresJSONBCodable: Codable, PostgresDataConvertible { }
5253

54+
@available(*, deprecated, message: "Deprecating conformance to `PostgresDataConvertible`, since it is deprecated.")
5355
extension PostgresJSONBCodable {
5456
public static var postgresDataType: PostgresDataType {
5557
return .jsonb

0 commit comments

Comments
 (0)