 import Axis
+import Foundation
 
 public enum Value {
     case string(String)

    }
}


extension Int: ValueConvertible {
    public init(rawSQLData buffer: Buffer) throws {
        guard let value = Int(try String(buffer: buffer)) else {
            throw ValueError(description: "Failed to convert data to Int")
        }
        self = value
    }

    public var sqlValue: Value {
        return .string(String(self))
    }
}

extension UInt: ValueConvertible {
    public init(rawSQLData buffer: Buffer) throws {
        guard let value = UInt(try String(buffer: buffer)) else {
            throw ValueError(description: "Failed to convert data to UInt")
        }
        self = value
    }

    public var sqlValue: Value {
        return .string(String(self))
    }
}


    }
}

extension Int : ValueConvertible {
    public init(rawSQLData buffer: Buffer) throws {
        guard let value = Int(try String(buffer: buffer)) else {
            throw ValueError(description: "Failed to convert data to Int")
        }
        self = value
    }

    public var sqlValue: Value {
        return .string(String(self))
    }
}

extension Int8 : ValueConvertible {
    public init(rawSQLData buffer: Buffer) throws {
        guard let value = Int8(try String(buffer: buffer)) else {
            throw ValueError(description: "Failed to convert data to Int")
        }
        self = value
    }

    public var sqlValue: Value {
        return .string(String(self))
    }
}

extension Int16 : ValueConvertible {
    public init(rawSQLData buffer: Buffer) throws {
        guard let value = Int16(try String(buffer: buffer)) else {
            throw ValueError(description: "Failed to convert data to Int")
        }
        self = value
    }

    public var sqlValue: Value {
        return .string(String(self))
    }
}

extension Int32 : ValueConvertible {
    public init(rawSQLData buffer: Buffer) throws {
        guard let value = Int32(try String(buffer: buffer)) else {
            throw ValueError(description: "Failed to convert data to Int")
        }
        self = value
    }

    public var sqlValue: Value {
        return .string(String(self))
    }
}

extension Int64 : ValueConvertible {
    public init(rawSQLData buffer: Buffer) throws {
        guard let value = Int64(try String(buffer: buffer)) else {
            throw ValueError(description: "Failed to convert data to Int")
        }
        self = value
    }

    public var sqlValue: Value {
        return .string(String(self))
    }
}

extension UInt: ValueConvertible {
    public init(rawSQLData buffer: Buffer) throws {
        guard let value = UInt(try String(buffer: buffer)) else {
            throw ValueError(description: "Failed to convert data to UInt")
        }
        self = value
    }

    public var sqlValue: Value {
        return .string(String(self))
    }
}

extension UInt8: ValueConvertible {
    public init(rawSQLData buffer: Buffer) throws {
        guard let value = UInt8(try String(buffer: buffer)) else {
            throw ValueError(description: "Failed to convert data to UInt")
        }
        self = value
    }

    public var sqlValue: Value {
        return .string(String(self))
    }
}

extension UInt16: ValueConvertible {
    public init(rawSQLData buffer: Buffer) throws {
        guard let value = UInt16(try String(buffer: buffer)) else {
            throw ValueError(description: "Failed to convert data to UInt")
        }
        self = value
    }

    public var sqlValue: Value {
        return .string(String(self))
    }
}

extension UInt32: ValueConvertible {
    public init(rawSQLData buffer: Buffer) throws {
        guard let value = UInt32(try String(buffer: buffer)) else {
            throw ValueError(description: "Failed to convert data to UInt")
        }
        self = value
    }

    public var sqlValue: Value {
        return .string(String(self))
    }
}

extension UInt64: ValueConvertible {
    public init(rawSQLData buffer: Buffer) throws {
        guard let value = UInt64(try String(buffer: buffer)) else {
            throw ValueError(description: "Failed to convert data to UInt")
        }
        self = value
    }

    public var sqlValue: Value {
        return .string(String(self))
    }
}
