From 185d00938068a079199b481c2b5d115ff40d5b55 Mon Sep 17 00:00:00 2001 From: Jaap Wijnen Date: Tue, 15 Oct 2019 02:28:16 +0200 Subject: [PATCH] conform PostgresData to PostgresDataConvertible (#51) * work in progress * return fatal error on static postgres data type --- Sources/PostgresNIO/Data/PostgresData.swift | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Sources/PostgresNIO/Data/PostgresData.swift b/Sources/PostgresNIO/Data/PostgresData.swift index e10e5e6a..d49747b8 100644 --- a/Sources/PostgresNIO/Data/PostgresData.swift +++ b/Sources/PostgresNIO/Data/PostgresData.swift @@ -79,3 +79,17 @@ public struct PostgresData: CustomStringConvertible, CustomDebugStringConvertibl return self.description } } + +extension PostgresData: PostgresDataConvertible { + public static var postgresDataType: PostgresDataType { + fatalError("PostgresData cannot be statically represented as a single data type") + } + + public init?(postgresData: PostgresData) { + self = postgresData + } + + public var postgresData: PostgresData? { + return self + } +}