Movatterモバイル変換


[0]ホーム

URL:


modulePostgreSQLBinary.EncoderwhereimportPostgreSQLBinary.PreludeimportqualifiedData.ByteStringasBimportqualifiedData.ByteString.Char8asBCimportqualifiedData.ByteString.BuilderasBBimportqualifiedData.ByteString.LazyasBLimportqualifiedData.ByteString.Lazy.Char8asBLCimportqualifiedData.TextasTimportqualifiedData.Text.EncodingasTEimportqualifiedData.Text.LazyasTLimportqualifiedData.Text.Lazy.EncodingasTLEimportqualifiedPostgreSQLBinary.Encoder.BuilderasBuilderimportqualifiedPostgreSQLBinary.ArrayasArrayimportqualifiedPostgreSQLBinary.TimeasTimeimportqualifiedPostgreSQLBinary.IntegralasIntegralimportqualifiedPostgreSQLBinary.NumericasNumeric-- |-- A function for rendering a value into a byte string.typeEa=a->ByteString-- * Numbers-------------------------{-# INLINABLE int2 #-}int2::E(EitherInt16Word16)int2=eitherunpackunpackwhereunpack=Integral.unpackBySize2{-# INLINABLE int4 #-}int4::E(EitherInt32Word32)int4=eitherunpackunpackwhereunpack=Integral.unpackBySize4{-# INLINABLE int8 #-}int8::E(EitherInt64Word64)int8=eitherunpackunpackwhereunpack=Integral.unpackBySize8{-# INLINABLE float4 #-}float4::EFloatfloat4=int4.Right.(unsafeCoerce::Float->Word32){-# INLINABLE float8 #-}float8::EDoublefloat8=int8.Right.(unsafeCoerce::Double->Word64){-# INLINABLE numeric #-}numeric::EScientificnumeric=Builder.run.Builder.numeric-- * Text--------------------------- |-- A UTF-8-encoded char.---- Note that since it's UTF-8-encoded-- not a \"char\" but a \"text\" OID should be used with it.{-# INLINABLE char #-}char::ECharchar=text.Left.T.singleton-- |-- Either a strict or a lazy text.{-# INLINABLE text #-}text::E(EitherTextTL.Text)text=eitherstrictlazywherestrict=TE.encodeUtf8.T.filter(/='\0')lazy=BL.toStrict.TLE.encodeUtf8.TL.filter(/='\0')-- |-- Either a strict or a lazy bytestring.{-# INLINABLE bytea #-}bytea::E(EitherByteStringBL.ByteString)bytea=eitheridBL.toStrict-- * Date and Time-------------------------{-# INLINABLE date #-}date::EDaydate=Builder.run.Builder.date-- |-- Encoding strategy depends on whether the server supports @integer_datetimes@.{-# INLINABLE time #-}time::Bool->ETimeOfDaytimeinteger_datetimes(TimeOfDayhms)=letp=unsafeCoerces::Integeru=p`div`(10^6)inifinteger_datetimesthenIntegral.unpackBySize8$fromIntegralu+10^6*60*(m+60*h)elseinlinefloat8$fromIntegralu/10^6+60*(fromIntegralm+60*(fromIntegralh))-- |-- Encoding strategy depends on whether the server supports @integer_datetimes@.{-# INLINABLE timetz #-}timetz::Bool->E(TimeOfDay,TimeZone)timetzinteger_datetimes(timeX,tzX)=inlinetimeinteger_datetimestimeX<>tztzXwheretz=Integral.unpackBySize4.(*60).negate.timeZoneMinutes{-# INLINABLE timestamp #-}timestamp::Bool->ELocalTimetimestamp=\caseTrue->int8.Left.Time.localTimeToMicrosFalse->float8.Time.localTimeToSecs{-# INLINABLE timestamptz #-}timestamptz::Bool->EUTCTimetimestamptz=\caseTrue->int8.Left.Time.utcToMicrosFalse->float8.Time.utcToSecs{-# INLINABLE interval #-}interval::EDiffTimeinterval=Builder.run.Builder.interval-- * Misc-------------------------{-# INLINABLE bool #-}bool::EBoolbool=\caseFalse->B.singleton0True->B.singleton1{-# INLINABLE uuid #-}uuid::EUUIDuuid=Builder.run.Builder.uuid{-# INLINABLE array #-}array::EArray.Dataarray=Builder.run.Builder.array

[8]ページ先頭

©2009-2025 Movatter.jp