git.iko.soy/typeable/postgresql-simple
on master help sign in
Add UUID to BuiltinTypes
2e985d9Leon P Smith
src/Database/PostgreSQL/Simple/BuiltinTypes.hs+8
@@ -71,6 +71,7 @@ data BuiltinType
71 | RefCursor
71 | RefCursor
72 | Record
72 | Record
73 | Void
73 | Void
74+ | UUID
74 deriving (Eq, Ord, Enum, Bounded, Read, Show, Typeable)
75 deriving (Eq, Ord, Enum, Bounded, Read, Show, Typeable)
75
76
76builtin2oid :: BuiltinType -> PQ.Oid
77builtin2oid :: BuiltinType -> PQ.Oid
@@ -120,6 +121,7 @@ builtin2oid typ = PQ.Oid $ case typ of
120 RefCursor -> 1790
121 RefCursor -> 1790
121 Record -> 2249
122 Record -> 2249
122 Void -> 2278
123 Void -> 2278
124+ UUID -> 2950
123
125
124oid2builtin :: PQ.Oid -> Maybe BuiltinType
126oid2builtin :: PQ.Oid -> Maybe BuiltinType
125oid2builtin (PQ.Oid x) = case x of
127oid2builtin (PQ.Oid x) = case x of
@@ -168,6 +170,7 @@ oid2builtin (PQ.Oid x) = case x of
168 1790 -> Just RefCursor
170 1790 -> Just RefCursor
169 2249 -> Just Record
171 2249 -> Just Record
170 2278 -> Just Void
172 2278 -> Just Void
173+ 2950 -> Just UUID
171 _ -> Nothing
174 _ -> Nothing
172
175
173builtin2typname :: BuiltinType -> ByteString
176builtin2typname :: BuiltinType -> ByteString
@@ -217,6 +220,7 @@ builtin2typname typ = case typ of
217 RefCursor -> refcursor
220 RefCursor -> refcursor
218 Record -> record
221 Record -> record
219 Void -> void
222 Void -> void
223+ UUID -> uuid
220
224
221oid2typname :: PQ.Oid -> Maybe ByteString
225oid2typname :: PQ.Oid -> Maybe ByteString
222oid2typname (PQ.Oid x) = case x of
226oid2typname (PQ.Oid x) = case x of
@@ -265,6 +269,7 @@ oid2typname (PQ.Oid x) = case x of
265 1790 -> Just refcursor
269 1790 -> Just refcursor
266 2249 -> Just record
270 2249 -> Just record
267 2278 -> Just void
271 2278 -> Just void
272+ 2950 -> Just uuid
268 _ -> Nothing
273 _ -> Nothing
269
274
270bool :: ByteString
275bool :: ByteString
@@ -401,3 +406,6 @@ record = "record"
401
406
402void :: ByteString
407void :: ByteString
403void = "void"
408void = "void"
409+
410+uuid :: ByteString
411+uuid = "uuid"
tools/GenBuiltinTypes.hs+1
@@ -83,6 +83,7 @@ numeric
83refcursor RefCursor
83refcursor RefCursor
84record
84record
85void
85void
86+uuid UUID
86|]
87|]
87
88
88instance IsString Blaze.Builder where
89instance IsString Blaze.Builder where