generated from tpl/purs
Merge branch 'sledorze-master'
This commit is contained in:
commit
97583e0cc8
@ -2,7 +2,8 @@
|
|||||||
|
|
||||||
purescript-postgresql-client is a PostgreSQL client library for PureScript.
|
purescript-postgresql-client is a PostgreSQL client library for PureScript.
|
||||||
|
|
||||||
To use this library, you need to add `pg` as an npm dependency.
|
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
|
The purspgpp preprocessor has been replaced by [sqltopurs], which is a code
|
||||||
generator instead of a preprocessor, and easier to use.
|
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.Eff (kind Effect)
|
||||||
import Control.Monad.Error.Class (throwError)
|
import Control.Monad.Error.Class (throwError)
|
||||||
import Control.Monad.Except (runExcept)
|
import Control.Monad.Except (runExcept)
|
||||||
|
import Data.Array as Array
|
||||||
import Data.Bifunctor (lmap)
|
import Data.Bifunctor (lmap)
|
||||||
import Data.ByteString (ByteString)
|
import Data.ByteString (ByteString)
|
||||||
import Data.DateTime.Instant (Instant)
|
import Data.DateTime.Instant (Instant)
|
||||||
@ -52,9 +53,15 @@ instance toSQLValueString :: ToSQLValue String where
|
|||||||
instance fromSQLValueString :: FromSQLValue String where
|
instance fromSQLValueString :: FromSQLValue String where
|
||||||
fromSQLValue = lmap show <<< runExcept <<< readString
|
fromSQLValue = lmap show <<< runExcept <<< readString
|
||||||
|
|
||||||
|
instance toSQLValueArray :: (ToSQLValue a) => ToSQLValue (Array a) where
|
||||||
|
toSQLValue = toForeign <<< map toSQLValue
|
||||||
|
|
||||||
instance fromSQLValueArray :: (FromSQLValue a) => FromSQLValue (Array a) where
|
instance fromSQLValueArray :: (FromSQLValue a) => FromSQLValue (Array a) where
|
||||||
fromSQLValue = traverse fromSQLValue <=< lmap show <<< runExcept <<< readArray
|
fromSQLValue = traverse fromSQLValue <=< lmap show <<< runExcept <<< readArray
|
||||||
|
|
||||||
|
instance toSQLValueList :: (ToSQLValue a) => ToSQLValue (List a) where
|
||||||
|
toSQLValue = toForeign <<< Array.fromFoldable <<< map toSQLValue
|
||||||
|
|
||||||
instance fromSQLValueList :: (FromSQLValue a) => FromSQLValue (List a) where
|
instance fromSQLValueList :: (FromSQLValue a) => FromSQLValue (List a) where
|
||||||
fromSQLValue = map List.fromFoldable <<< traverse fromSQLValue <=< lmap show <<< runExcept <<< readArray
|
fromSQLValue = map List.fromFoldable <<< traverse fromSQLValue <=< lmap show <<< runExcept <<< readArray
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user