Skip to content

Commit 390c22c

Browse files
committed
add decimal support
1 parent 64f9c20 commit 390c22c

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import Core
2+
3+
extension Decimal: PostgreSQLDataConvertible {
4+
/// See `PostgreSQLDataConvertible`
5+
public static var postgreSQLDataType: PostgreSQLDataType {
6+
return Double.postgreSQLDataType
7+
}
8+
9+
/// See `PostgreSQLDataConvertible`
10+
public static var postgreSQLDataArrayType: PostgreSQLDataType {
11+
return Double.postgreSQLDataArrayType
12+
}
13+
14+
/// See `PostgreSQLDataConvertible`
15+
public static func convertFromPostgreSQLData(_ data: PostgreSQLData) throws -> Decimal {
16+
return try Decimal(Double.convertFromPostgreSQLData(data))
17+
}
18+
19+
/// See `PostgreSQLDataConvertible`
20+
public func convertToPostgreSQLData() throws -> PostgreSQLData {
21+
return try Double(description).convertToPostgreSQLData()
22+
}
23+
}

0 commit comments

Comments
 (0)