         return formatter
     }()
     
+    /// Converts from a date represented in a typical ISO-8601-style SQL format.
+    /// 
+    /// By default, `Date`s are represented in UTC in the format 
+    /// `yyyy-MM-dd HH:mm:ss.SSSSSS`.
     public init?(sqlLiteral string: String) {
         guard let d = Date.postgresFormatter.date(from: string) else {
             return nil


import Foundation

public protocol SQLValue {
    init?(sqlLiteral string: String)
    var sqlLiteral: String { get }
}

public protocol SQLStringConvertible: SQLValue {}

extension SQLValue where Self: LosslessStringConvertible {

        self = d
    }
    
    /// Converts to a date represented in a typical ISO-8601-style SQL format.
    /// 
    /// By default, `Date`s are represented in UTC in the format 
    /// `yyyy-MM-dd HH:mm:ss.SSSSSS`.
    public var sqlLiteral: String {
        return Date.postgresFormatter.string(from: self)
    }
}

extension Data: SQLValue {
    /// Converts from a blob literal represented in hexadecimal format.
    public init?(sqlLiteral string: String) {
        self.init(hexEncoded: string)
    }
    
    /// Converts to a blob literal represented in hexadecimal format.
    public var sqlLiteral: String {
        return hexEncodedString()
    }
}

extension URL: SQLStringConvertible {
    /// Converts from a URL represented as a string.
    public init?(sqlLiteral string: String) {
        self.init(string: string)
    }
    
    /// Converts to a URL represented as a string.
    /// 
    /// - Note: There is no distinction between the relative and absolute parts of 
    ///           the URL, so they will be merged when the URL returns through this 
    ///           protocol.
    public var sqlLiteral: String {
        return absoluteString
    }
