Skip to content

Commit 970ae9b

Browse files
committed
make psql data type equatable
1 parent 6266940 commit 970ae9b

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

Sources/PostgreSQL/SQL/PostgreSQLQuery+DataType.swift

+9-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
1-
public struct PostgreSQLDataType: SQLDataType {
1+
public struct PostgreSQLDataType: SQLDataType, Equatable {
2+
/// See `Equatable`.
3+
public static func == (lhs: PostgreSQLDataType, rhs: PostgreSQLDataType) -> Bool {
4+
// FIXME: more performant equatable is possible
5+
var binds: [Encodable] = []
6+
return lhs.serialize(&binds) == rhs.serialize(&binds)
7+
}
8+
9+
/// See `SQLDataType`.
210
public static func dataType(appropriateFor type: Any.Type) -> PostgreSQLDataType? {
311
guard let type = type as? PostgreSQLDataTypeStaticRepresentable.Type else {
412
return .jsonb

0 commit comments

Comments
 (0)