generated from tpl/purs
Formatting
This commit is contained in:
parent
49a2465e5f
commit
13d0fcfb8e
@ -2,9 +2,8 @@
|
||||
|
||||
purescript-postgresql-client is a PostgreSQL client library for PureScript.
|
||||
|
||||
To use this library, you need to add `pg` as an npm dependency.
|
||||
|
||||
`pg` being the npm repo of https://github.com/brianc/node-postgres
|
||||
To use this library, you need to add `pg` as an npm dependency. You can also
|
||||
find this npm library on [https://github.com/brianc/node-postgres][pg].
|
||||
|
||||
The purspgpp preprocessor has been replaced by [sqltopurs], which is a code
|
||||
generator instead of a preprocessor, and easier to use.
|
||||
|
@ -3,6 +3,7 @@ module Database.PostgreSQL.Value where
|
||||
import Control.Monad.Eff (kind Effect)
|
||||
import Control.Monad.Error.Class (throwError)
|
||||
import Control.Monad.Except (runExcept)
|
||||
import Data.Array as Array
|
||||
import Data.Bifunctor (lmap)
|
||||
import Data.ByteString (ByteString)
|
||||
import Data.DateTime.Instant (Instant)
|
||||
@ -10,7 +11,6 @@ import Data.Either (Either)
|
||||
import Data.Foreign (Foreign, isNull, readArray, readBoolean, readChar, readInt, readNumber, readString, toForeign, unsafeFromForeign)
|
||||
import Data.List (List)
|
||||
import Data.List as List
|
||||
import Data.Array(fromFoldable)
|
||||
import Data.Maybe (Maybe(..))
|
||||
import Data.Traversable (traverse)
|
||||
import Prelude
|
||||
@ -53,17 +53,17 @@ instance toSQLValueString :: ToSQLValue String where
|
||||
instance fromSQLValueString :: FromSQLValue String where
|
||||
fromSQLValue = lmap show <<< runExcept <<< readString
|
||||
|
||||
instance fromSQLValueArray :: (FromSQLValue a) => FromSQLValue (Array a) where
|
||||
fromSQLValue = traverse fromSQLValue <=< lmap show <<< runExcept <<< readArray
|
||||
|
||||
instance toSQLValueArray :: (ToSQLValue a) => ToSQLValue (Array a) where
|
||||
toSQLValue = toForeign <<< map toSQLValue
|
||||
|
||||
instance fromSQLValueList :: (FromSQLValue a) => FromSQLValue (List a) where
|
||||
fromSQLValue = map List.fromFoldable <<< traverse fromSQLValue <=< lmap show <<< runExcept <<< readArray
|
||||
instance fromSQLValueArray :: (FromSQLValue a) => FromSQLValue (Array a) where
|
||||
fromSQLValue = traverse fromSQLValue <=< lmap show <<< runExcept <<< readArray
|
||||
|
||||
instance toSQLValueList :: (ToSQLValue a) => ToSQLValue (List a) where
|
||||
toSQLValue = toForeign <<< fromFoldable <<< map toSQLValue
|
||||
toSQLValue = toForeign <<< Array.fromFoldable <<< map toSQLValue
|
||||
|
||||
instance fromSQLValueList :: (FromSQLValue a) => FromSQLValue (List a) where
|
||||
fromSQLValue = map List.fromFoldable <<< traverse fromSQLValue <=< lmap show <<< runExcept <<< readArray
|
||||
|
||||
instance toSQLValueByteString :: ToSQLValue ByteString where
|
||||
toSQLValue = toForeign
|
||||
|
Loading…
Reference in New Issue
Block a user