This commit is contained in:
Kei Hibino 2016-04-30 17:30:21 +09:00
commit 976a499eee
2 changed files with 10 additions and 2 deletions

View File

@ -29,7 +29,7 @@ import qualified Data.Text as T
import qualified Data.Text.Encoding as T
import qualified Data.Text.Lazy as LT
import Text.Printf (PrintfArg, printf)
import Data.Time (FormatTime, Day, TimeOfDay, LocalTime, formatTime)
import Data.Time (FormatTime, Day, TimeOfDay, LocalTime, UTCTime, ZonedTime, formatTime)
import Data.Time.Locale.Compat (defaultTimeLocale)
import Language.SQL.Keyword (Keyword (..))
@ -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)