Skip to content

Commit

Permalink
Improved binary support
Browse files Browse the repository at this point in the history
  • Loading branch information
mpscholten committed Oct 15, 2020
1 parent c7ddd9b commit d9561e3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions IHP/ModelSupport.hs
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,14 @@ instance Default Day where
instance Default UTCTime where
def = UTCTime def 0

instance Default (PG.Binary ByteString) where
def = PG.Binary ""

instance Newtype.Newtype (PG.Binary payload) where
type O (PG.Binary payload) = payload
pack = PG.Binary
unpack (PG.Binary payload) = payload

class Record model where
newRecord :: model

Expand Down
2 changes: 1 addition & 1 deletion IHP/SchemaCompiler.hs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ atomicType = \case
PReal -> "Float"
PDouble -> "Double"
PDate -> "Data.Time.Calendar.Day"
PBinary -> "Binary"
PBinary -> "(Binary ByteString)"
PTime -> "TimeOfDay"
PCustomType theType -> tableNameToModelName theType
PTimestamp -> "LocalTime"
Expand Down

0 comments on commit d9561e3

Please sign in to comment.