Support for ZonedTime and UTCTime

This commit is contained in:
Blaz Repas 2016-02-28 19:40:26 +01:00
parent e6bb2bcada
commit 851a142e06
2 changed files with 9 additions and 1 deletions

View File

@ -160,6 +160,14 @@ instance ShowConstantTermsSQL TimeOfDay where
instance ShowConstantTermsSQL LocalTime where
showConstantTermsSQL' = constantTimeTerms TIMESTAMP "%Y-%m-%d %H:%M:%S"
-- | Constant SQL terms of 'ZonedTime'.
instance ShowConstantTermsSQL ZonedTime where
showConstantTermsSQL' = constantTimeTerms TIMESTAMPTZ "%Y-%m-%d %H:%M:%S%z"
-- | Constant SQL terms of 'ZonedTime'.
instance ShowConstantTermsSQL UTCTime where
showConstantTermsSQL' = constantTimeTerms TIMESTAMPTZ "%Y-%m-%d %H:%M:%S%z"
showMaybeTerms :: ShowConstantTermsSQL a => PersistableRecordWidth a -> Maybe a -> [StringSQL]
showMaybeTerms wa = d where
d (Just a) = showConstantTermsSQL' a

View File

@ -91,7 +91,7 @@ data Keyword = SELECT | ALL | DISTINCT | ON
| IS | NULL | IN
| DATE | TIME | TIMESTAMP | INTERVAL
| DATE | TIME | TIMESTAMP | TIMESTAMPTZ | INTERVAL
| Sequence !DString
deriving (Read, Show)