generated from tpl/purs
Migrate to Purescript 0.12.
This commit is contained in:
parent
bceb1e399d
commit
bead426f14
42
bower.json
42
bower.json
@ -2,32 +2,32 @@
|
||||
"name": "purescript-postgresql-client",
|
||||
"license": "BSD-3-Clause",
|
||||
"dependencies": {
|
||||
"purescript-prelude": "^3.0.0",
|
||||
"purescript-transformers": "^3.2.0",
|
||||
"purescript-lists": "^4.0.1",
|
||||
"purescript-foreign": "^4.0.0",
|
||||
"purescript-aff": "^4.0.0",
|
||||
"purescript-either": "^3.0.0",
|
||||
"purescript-maybe": "^3.0.0",
|
||||
"purescript-foldable-traversable": "^3.0.0",
|
||||
"purescript-newtype": "^2.0.0",
|
||||
"purescript-bytestrings": "^5.0.1",
|
||||
"purescript-arrays": "^4.0.1",
|
||||
"purescript-datetime": "^3.0.0",
|
||||
"purescript-bifunctors": "^3.0.0",
|
||||
"purescript-eff": "^3.1.0",
|
||||
"purescript-exceptions": "^3.0.0",
|
||||
"purescript-decimals": "^3.4.0",
|
||||
"purescript-js-date": "^5.2.0"
|
||||
"purescript-prelude": "^4.0.1",
|
||||
"purescript-transformers": "^4.1.0",
|
||||
"purescript-lists": "^5.0.0",
|
||||
"purescript-foreign": "^5.0.0",
|
||||
"purescript-aff": "^5.0.1",
|
||||
"purescript-either": "^4.0.0",
|
||||
"purescript-maybe": "^4.0.0",
|
||||
"purescript-foldable-traversable": "^4.0.0",
|
||||
"purescript-newtype": "^3.0.0",
|
||||
"purescript-bytestrings": "adamczykm/purescript-bytestrings#7.0.0",
|
||||
"purescript-arrays": "^5.0.0",
|
||||
"purescript-datetime": "^4.0.0",
|
||||
"purescript-bifunctors": "^4.0.0",
|
||||
"purescript-effect": "^2.0.0",
|
||||
"purescript-exceptions": "^4.0.0",
|
||||
"purescript-decimals": "^4.0.0",
|
||||
"purescript-js-date": "^6.0.0"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/rightfold/purescript-postgresql-client.git"
|
||||
},
|
||||
"devDependencies": {
|
||||
"purescript-assert": "^3.0.0",
|
||||
"purescript-eff": "^3.1.0",
|
||||
"purescript-debug": "^3.0.0",
|
||||
"purescript-test-unit": "^13.0.0"
|
||||
"purescript-assert": "^4.0.0",
|
||||
"purescript-effect": "^2.0.0",
|
||||
"purescript-debug": "^4.0.0",
|
||||
"purescript-test-unit": "^14.0.0"
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,10 @@
|
||||
{
|
||||
"name": "purescript-postgresql-client",
|
||||
"dependencies": {
|
||||
"bower-dependency-tree": "^0.1.2",
|
||||
"decimal.js": "^10.0.0",
|
||||
"g": "^2.0.1",
|
||||
"global": "^4.3.2",
|
||||
"pg": "^6.1.2"
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
module Database.PostgreSQL
|
||||
( module Row
|
||||
, module Value
|
||||
, POSTGRESQL
|
||||
, PoolConfiguration
|
||||
, Pool
|
||||
, Connection
|
||||
@ -17,24 +16,23 @@ module Database.PostgreSQL
|
||||
|
||||
import Prelude
|
||||
|
||||
import Control.Monad.Aff (Aff, bracket)
|
||||
import Control.Monad.Aff.Compat (EffFnAff, fromEffFnAff)
|
||||
import Control.Monad.Eff (kind Effect, Eff)
|
||||
import Control.Monad.Eff.Class (liftEff)
|
||||
import Control.Monad.Eff.Exception (error)
|
||||
import Effect.Aff (Aff, bracket)
|
||||
import Effect.Aff.Compat (EffectFnAff, fromEffectFnAff)
|
||||
import Effect (Effect)
|
||||
import Effect.Class (liftEffect)
|
||||
import Effect.Exception (error)
|
||||
import Control.Monad.Error.Class (catchError, throwError)
|
||||
import Data.Array (head)
|
||||
import Data.Either (Either(..))
|
||||
import Data.Foreign (Foreign)
|
||||
import Foreign (Foreign)
|
||||
import Data.Maybe (Maybe(..))
|
||||
import Data.Newtype (class Newtype)
|
||||
import Data.Traversable (traverse)
|
||||
import Database.PostgreSQL.Row (class FromSQLRow, class ToSQLRow, Row0(..), Row1(..), fromSQLRow, toSQLRow)
|
||||
import Database.PostgreSQL.Row as Row
|
||||
import Database.PostgreSQL.Row (class FromSQLRow, class ToSQLRow, Row0(..), Row1(..), Row10(..), Row11(..), Row12(..), Row13(..), Row14(..), Row15(..), Row16(..), Row17(..), Row18(..), Row19(..), Row2(..), Row3(..), Row4(..), Row5(..), Row6(..), Row7(..), Row8(..), Row9(..), fromSQLRow, toSQLRow) as Row
|
||||
import Database.PostgreSQL.Value (class FromSQLValue)
|
||||
import Database.PostgreSQL.Value as Value
|
||||
import Database.PostgreSQL.Value (class FromSQLValue, class ToSQLValue, fromSQLValue, instantFromString, instantToString, null, toSQLValue, unsafeIsBuffer) as Value
|
||||
|
||||
foreign import data POSTGRESQL :: Effect
|
||||
|
||||
-- | PostgreSQL connection pool configuration.
|
||||
type PoolConfiguration =
|
||||
@ -59,46 +57,39 @@ newtype Query i o = Query String
|
||||
derive instance newtypeQuery :: Newtype (Query i o) _
|
||||
|
||||
-- | Create a new connection pool.
|
||||
newPool :: ∀ eff. PoolConfiguration -> Aff (postgreSQL :: POSTGRESQL | eff) Pool
|
||||
newPool = liftEff <<< ffiNewPool
|
||||
newPool :: PoolConfiguration -> Aff Pool
|
||||
newPool = liftEffect <<< ffiNewPool
|
||||
|
||||
foreign import ffiNewPool
|
||||
:: ∀ eff
|
||||
. PoolConfiguration
|
||||
-> Eff (postgreSQL :: POSTGRESQL | eff) Pool
|
||||
:: PoolConfiguration
|
||||
-> Effect Pool
|
||||
|
||||
-- | Run an action with a connection. The connection is released to the pool
|
||||
-- | when the action returns.
|
||||
withConnection
|
||||
:: ∀ eff a
|
||||
:: ∀ a
|
||||
. Pool
|
||||
-> (Connection -> Aff (postgreSQL :: POSTGRESQL | eff) a)
|
||||
-> Aff (postgreSQL :: POSTGRESQL | eff) a
|
||||
-> (Connection -> Aff a)
|
||||
-> Aff a
|
||||
withConnection p k =
|
||||
bracket
|
||||
(connect p)
|
||||
(liftEff <<< _.done)
|
||||
(liftEffect <<< _.done)
|
||||
(k <<< _.connection)
|
||||
|
||||
type PostgreSqlEff eff = (postgreSQL :: POSTGRESQL | eff)
|
||||
|
||||
connect
|
||||
:: ∀ eff
|
||||
. Pool
|
||||
:: Pool
|
||||
-> Aff
|
||||
(postgreSQL :: POSTGRESQL | eff)
|
||||
{ connection :: Connection
|
||||
, done :: Eff (PostgreSqlEff eff) Unit
|
||||
, done :: Effect Unit
|
||||
}
|
||||
connect = fromEffFnAff <<< ffiConnect
|
||||
connect = fromEffectFnAff <<< ffiConnect
|
||||
|
||||
foreign import ffiConnect
|
||||
:: ∀ eff
|
||||
. Pool
|
||||
-> EffFnAff
|
||||
(PostgreSqlEff eff)
|
||||
:: Pool
|
||||
-> EffectFnAff
|
||||
{ connection :: Connection
|
||||
, done :: Eff (PostgreSqlEff eff) Unit
|
||||
, done :: Effect Unit
|
||||
}
|
||||
|
||||
-- | Run an action within a transaction. The transaction is committed if the
|
||||
@ -106,10 +97,10 @@ foreign import ffiConnect
|
||||
-- | change the transaction mode, issue a separate `SET TRANSACTION` statement
|
||||
-- | within the transaction.
|
||||
withTransaction
|
||||
:: ∀ eff a
|
||||
:: ∀ a
|
||||
. Connection
|
||||
-> Aff (postgreSQL :: POSTGRESQL | eff) a
|
||||
-> Aff (postgreSQL :: POSTGRESQL | eff) a
|
||||
-> Aff a
|
||||
-> Aff a
|
||||
withTransaction conn action =
|
||||
execute conn (Query "BEGIN TRANSACTION") Row0
|
||||
*> catchError (Right <$> action) (pure <<< Left) >>= case _ of
|
||||
@ -118,24 +109,24 @@ withTransaction conn action =
|
||||
|
||||
-- | Execute a PostgreSQL query and discard its results.
|
||||
execute
|
||||
:: ∀ i o eff
|
||||
:: ∀ i o
|
||||
. (ToSQLRow i)
|
||||
=> Connection
|
||||
-> Query i o
|
||||
-> i
|
||||
-> Aff (postgreSQL :: POSTGRESQL | eff) Unit
|
||||
-> Aff Unit
|
||||
execute conn (Query sql) values =
|
||||
void $ unsafeQuery conn sql (toSQLRow values)
|
||||
|
||||
-- | Execute a PostgreSQL query and return its results.
|
||||
query
|
||||
:: ∀ i o eff
|
||||
:: ∀ i o
|
||||
. ToSQLRow i
|
||||
=> FromSQLRow o
|
||||
=> Connection
|
||||
-> Query i o
|
||||
-> i
|
||||
-> Aff (postgreSQL :: POSTGRESQL | eff) (Array o)
|
||||
-> Aff (Array o)
|
||||
query conn (Query sql) values =
|
||||
unsafeQuery conn sql (toSQLRow values)
|
||||
>>= traverse (fromSQLRow >>> case _ of
|
||||
@ -145,31 +136,29 @@ query conn (Query sql) values =
|
||||
-- | Execute a PostgreSQL query and return the first field of the first row in
|
||||
-- | the result.
|
||||
scalar
|
||||
:: ∀ i o eff
|
||||
:: ∀ i o
|
||||
. ToSQLRow i
|
||||
=> FromSQLValue o
|
||||
=> Connection
|
||||
-> Query i (Row1 o)
|
||||
-> i
|
||||
-> Aff (postgreSQL :: POSTGRESQL | eff) (Maybe o)
|
||||
-> Aff (Maybe o)
|
||||
scalar conn sql values =
|
||||
query conn sql values
|
||||
<#> map (case _ of Row1 a -> a) <<< head
|
||||
|
||||
unsafeQuery
|
||||
:: ∀ eff
|
||||
. Connection
|
||||
:: Connection
|
||||
-> String
|
||||
-> Array Foreign
|
||||
-> Aff (postgreSQL :: POSTGRESQL | eff) (Array (Array Foreign))
|
||||
unsafeQuery c s = fromEffFnAff <<< ffiUnsafeQuery c s
|
||||
-> Aff (Array (Array Foreign))
|
||||
unsafeQuery c s = fromEffectFnAff <<< ffiUnsafeQuery c s
|
||||
|
||||
foreign import ffiUnsafeQuery
|
||||
:: ∀ eff
|
||||
. Connection
|
||||
:: Connection
|
||||
-> String
|
||||
-> Array Foreign
|
||||
-> EffFnAff (postgreSQL :: POSTGRESQL | eff) (Array (Array Foreign))
|
||||
-> EffectFnAff (Array (Array Foreign))
|
||||
|
||||
fromRight :: ∀ a b. Either a b -> Maybe b
|
||||
fromRight (Left _) = Nothing
|
||||
|
@ -2,7 +2,7 @@ module Database.PostgreSQL.Row where
|
||||
|
||||
import Data.Array as Array
|
||||
import Data.Either (Either(..))
|
||||
import Data.Foreign (Foreign)
|
||||
import Foreign (Foreign)
|
||||
import Database.PostgreSQL.Value (class FromSQLValue, class ToSQLValue, fromSQLValue, toSQLValue)
|
||||
import Prelude
|
||||
|
||||
@ -13,9 +13,9 @@ class ToSQLRow a where
|
||||
-- | Convert things from SQL rows.
|
||||
class FromSQLRow a where
|
||||
fromSQLRow :: Array Foreign -> Either String a
|
||||
|
||||
|
||||
instance toSQLRowForeignArray :: ToSQLRow (Array Foreign) where
|
||||
toSQLRow = id
|
||||
toSQLRow = identity
|
||||
|
||||
-- | A row with 0 fields.
|
||||
data Row0 = Row0
|
||||
@ -44,7 +44,7 @@ derive instance eqRow1 :: (Eq a) => Eq (Row1 a)
|
||||
derive instance ordRow1 :: (Ord a) => Ord (Row1 a)
|
||||
|
||||
instance showRow1 :: (Show a) => Show (Row1 a) where
|
||||
show (Row1 a) =
|
||||
show (Row1 a) =
|
||||
"(Row1 " <> show a <> ")"
|
||||
|
||||
instance fromSQLRowRow1 :: (FromSQLValue a) => FromSQLRow (Row1 a) where
|
||||
@ -55,7 +55,7 @@ instance fromSQLRowRow1 :: (FromSQLValue a) => FromSQLRow (Row1 a) where
|
||||
where n = Array.length xs
|
||||
|
||||
instance toSQLRowRow1 :: (ToSQLValue a) => ToSQLRow (Row1 a) where
|
||||
toSQLRow (Row1 a) =
|
||||
toSQLRow (Row1 a) =
|
||||
[toSQLValue a]
|
||||
-- | A row with 2 fields.
|
||||
data Row2 a b = Row2 a b
|
||||
@ -65,7 +65,7 @@ derive instance eqRow2 :: (Eq a, Eq b) => Eq (Row2 a b)
|
||||
derive instance ordRow2 :: (Ord a, Ord b) => Ord (Row2 a b)
|
||||
|
||||
instance showRow2 :: (Show a, Show b) => Show (Row2 a b) where
|
||||
show (Row2 a b) =
|
||||
show (Row2 a b) =
|
||||
"(Row2 " <> show a <> " " <> show b <> ")"
|
||||
|
||||
instance fromSQLRowRow2 :: (FromSQLValue a, FromSQLValue b) => FromSQLRow (Row2 a b) where
|
||||
@ -77,7 +77,7 @@ instance fromSQLRowRow2 :: (FromSQLValue a, FromSQLValue b) => FromSQLRow (Row2
|
||||
where n = Array.length xs
|
||||
|
||||
instance toSQLRowRow2 :: (ToSQLValue a, ToSQLValue b) => ToSQLRow (Row2 a b) where
|
||||
toSQLRow (Row2 a b) =
|
||||
toSQLRow (Row2 a b) =
|
||||
[toSQLValue a, toSQLValue b]
|
||||
-- | A row with 3 fields.
|
||||
data Row3 a b c = Row3 a b c
|
||||
@ -87,7 +87,7 @@ derive instance eqRow3 :: (Eq a, Eq b, Eq c) => Eq (Row3 a b c)
|
||||
derive instance ordRow3 :: (Ord a, Ord b, Ord c) => Ord (Row3 a b c)
|
||||
|
||||
instance showRow3 :: (Show a, Show b, Show c) => Show (Row3 a b c) where
|
||||
show (Row3 a b c) =
|
||||
show (Row3 a b c) =
|
||||
"(Row3 " <> show a <> " " <> show b <> " " <> show c <> ")"
|
||||
|
||||
instance fromSQLRowRow3 :: (FromSQLValue a, FromSQLValue b, FromSQLValue c) => FromSQLRow (Row3 a b c) where
|
||||
@ -100,7 +100,7 @@ instance fromSQLRowRow3 :: (FromSQLValue a, FromSQLValue b, FromSQLValue c) => F
|
||||
where n = Array.length xs
|
||||
|
||||
instance toSQLRowRow3 :: (ToSQLValue a, ToSQLValue b, ToSQLValue c) => ToSQLRow (Row3 a b c) where
|
||||
toSQLRow (Row3 a b c) =
|
||||
toSQLRow (Row3 a b c) =
|
||||
[toSQLValue a, toSQLValue b, toSQLValue c]
|
||||
-- | A row with 4 fields.
|
||||
data Row4 a b c d = Row4 a b c d
|
||||
@ -110,7 +110,7 @@ derive instance eqRow4 :: (Eq a, Eq b, Eq c, Eq d) => Eq (Row4 a b c d)
|
||||
derive instance ordRow4 :: (Ord a, Ord b, Ord c, Ord d) => Ord (Row4 a b c d)
|
||||
|
||||
instance showRow4 :: (Show a, Show b, Show c, Show d) => Show (Row4 a b c d) where
|
||||
show (Row4 a b c d) =
|
||||
show (Row4 a b c d) =
|
||||
"(Row4 " <> show a <> " " <> show b <> " " <> show c <> " " <> show d <> ")"
|
||||
|
||||
instance fromSQLRowRow4 :: (FromSQLValue a, FromSQLValue b, FromSQLValue c, FromSQLValue d) => FromSQLRow (Row4 a b c d) where
|
||||
@ -124,7 +124,7 @@ instance fromSQLRowRow4 :: (FromSQLValue a, FromSQLValue b, FromSQLValue c, From
|
||||
where n = Array.length xs
|
||||
|
||||
instance toSQLRowRow4 :: (ToSQLValue a, ToSQLValue b, ToSQLValue c, ToSQLValue d) => ToSQLRow (Row4 a b c d) where
|
||||
toSQLRow (Row4 a b c d) =
|
||||
toSQLRow (Row4 a b c d) =
|
||||
[toSQLValue a, toSQLValue b, toSQLValue c, toSQLValue d]
|
||||
-- | A row with 5 fields.
|
||||
data Row5 a b c d e = Row5 a b c d e
|
||||
@ -134,7 +134,7 @@ derive instance eqRow5 :: (Eq a, Eq b, Eq c, Eq d, Eq e) => Eq (Row5 a b c d e)
|
||||
derive instance ordRow5 :: (Ord a, Ord b, Ord c, Ord d, Ord e) => Ord (Row5 a b c d e)
|
||||
|
||||
instance showRow5 :: (Show a, Show b, Show c, Show d, Show e) => Show (Row5 a b c d e) where
|
||||
show (Row5 a b c d e) =
|
||||
show (Row5 a b c d e) =
|
||||
"(Row5 " <> show a <> " " <> show b <> " " <> show c <> " " <> show d <> " " <> show e <> ")"
|
||||
|
||||
instance fromSQLRowRow5 :: (FromSQLValue a, FromSQLValue b, FromSQLValue c, FromSQLValue d, FromSQLValue e) => FromSQLRow (Row5 a b c d e) where
|
||||
@ -149,7 +149,7 @@ instance fromSQLRowRow5 :: (FromSQLValue a, FromSQLValue b, FromSQLValue c, From
|
||||
where n = Array.length xs
|
||||
|
||||
instance toSQLRowRow5 :: (ToSQLValue a, ToSQLValue b, ToSQLValue c, ToSQLValue d, ToSQLValue e) => ToSQLRow (Row5 a b c d e) where
|
||||
toSQLRow (Row5 a b c d e) =
|
||||
toSQLRow (Row5 a b c d e) =
|
||||
[toSQLValue a, toSQLValue b, toSQLValue c, toSQLValue d, toSQLValue e]
|
||||
-- | A row with 6 fields.
|
||||
data Row6 a b c d e f = Row6 a b c d e f
|
||||
@ -159,7 +159,7 @@ derive instance eqRow6 :: (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f) => Eq (Row6 a b c
|
||||
derive instance ordRow6 :: (Ord a, Ord b, Ord c, Ord d, Ord e, Ord f) => Ord (Row6 a b c d e f)
|
||||
|
||||
instance showRow6 :: (Show a, Show b, Show c, Show d, Show e, Show f) => Show (Row6 a b c d e f) where
|
||||
show (Row6 a b c d e f) =
|
||||
show (Row6 a b c d e f) =
|
||||
"(Row6 " <> show a <> " " <> show b <> " " <> show c <> " " <> show d <> " " <> show e <> " " <> show f <> ")"
|
||||
|
||||
instance fromSQLRowRow6 :: (FromSQLValue a, FromSQLValue b, FromSQLValue c, FromSQLValue d, FromSQLValue e, FromSQLValue f) => FromSQLRow (Row6 a b c d e f) where
|
||||
@ -175,7 +175,7 @@ instance fromSQLRowRow6 :: (FromSQLValue a, FromSQLValue b, FromSQLValue c, From
|
||||
where n = Array.length xs
|
||||
|
||||
instance toSQLRowRow6 :: (ToSQLValue a, ToSQLValue b, ToSQLValue c, ToSQLValue d, ToSQLValue e, ToSQLValue f) => ToSQLRow (Row6 a b c d e f) where
|
||||
toSQLRow (Row6 a b c d e f) =
|
||||
toSQLRow (Row6 a b c d e f) =
|
||||
[toSQLValue a, toSQLValue b, toSQLValue c, toSQLValue d, toSQLValue e, toSQLValue f]
|
||||
-- | A row with 7 fields.
|
||||
data Row7 a b c d e f g = Row7 a b c d e f g
|
||||
@ -185,7 +185,7 @@ derive instance eqRow7 :: (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g) => Eq (Row7
|
||||
derive instance ordRow7 :: (Ord a, Ord b, Ord c, Ord d, Ord e, Ord f, Ord g) => Ord (Row7 a b c d e f g)
|
||||
|
||||
instance showRow7 :: (Show a, Show b, Show c, Show d, Show e, Show f, Show g) => Show (Row7 a b c d e f g) where
|
||||
show (Row7 a b c d e f g) =
|
||||
show (Row7 a b c d e f g) =
|
||||
"(Row7 " <> show a <> " " <> show b <> " " <> show c <> " " <> show d <> " " <> show e <> " " <> show f <> " " <> show g <> ")"
|
||||
|
||||
instance fromSQLRowRow7 :: (FromSQLValue a, FromSQLValue b, FromSQLValue c, FromSQLValue d, FromSQLValue e, FromSQLValue f, FromSQLValue g) => FromSQLRow (Row7 a b c d e f g) where
|
||||
@ -202,7 +202,7 @@ instance fromSQLRowRow7 :: (FromSQLValue a, FromSQLValue b, FromSQLValue c, From
|
||||
where n = Array.length xs
|
||||
|
||||
instance toSQLRowRow7 :: (ToSQLValue a, ToSQLValue b, ToSQLValue c, ToSQLValue d, ToSQLValue e, ToSQLValue f, ToSQLValue g) => ToSQLRow (Row7 a b c d e f g) where
|
||||
toSQLRow (Row7 a b c d e f g) =
|
||||
toSQLRow (Row7 a b c d e f g) =
|
||||
[toSQLValue a, toSQLValue b, toSQLValue c, toSQLValue d, toSQLValue e, toSQLValue f, toSQLValue g]
|
||||
-- | A row with 8 fields.
|
||||
data Row8 a b c d e f g h = Row8 a b c d e f g h
|
||||
@ -212,7 +212,7 @@ derive instance eqRow8 :: (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h) => Eq
|
||||
derive instance ordRow8 :: (Ord a, Ord b, Ord c, Ord d, Ord e, Ord f, Ord g, Ord h) => Ord (Row8 a b c d e f g h)
|
||||
|
||||
instance showRow8 :: (Show a, Show b, Show c, Show d, Show e, Show f, Show g, Show h) => Show (Row8 a b c d e f g h) where
|
||||
show (Row8 a b c d e f g h) =
|
||||
show (Row8 a b c d e f g h) =
|
||||
"(Row8 " <> show a <> " " <> show b <> " " <> show c <> " " <> show d <> " " <> show e <> " " <> show f <> " " <> show g <> " " <> show h <> ")"
|
||||
|
||||
instance fromSQLRowRow8 :: (FromSQLValue a, FromSQLValue b, FromSQLValue c, FromSQLValue d, FromSQLValue e, FromSQLValue f, FromSQLValue g, FromSQLValue h) => FromSQLRow (Row8 a b c d e f g h) where
|
||||
@ -230,7 +230,7 @@ instance fromSQLRowRow8 :: (FromSQLValue a, FromSQLValue b, FromSQLValue c, From
|
||||
where n = Array.length xs
|
||||
|
||||
instance toSQLRowRow8 :: (ToSQLValue a, ToSQLValue b, ToSQLValue c, ToSQLValue d, ToSQLValue e, ToSQLValue f, ToSQLValue g, ToSQLValue h) => ToSQLRow (Row8 a b c d e f g h) where
|
||||
toSQLRow (Row8 a b c d e f g h) =
|
||||
toSQLRow (Row8 a b c d e f g h) =
|
||||
[toSQLValue a, toSQLValue b, toSQLValue c, toSQLValue d, toSQLValue e, toSQLValue f, toSQLValue g, toSQLValue h]
|
||||
-- | A row with 9 fields.
|
||||
data Row9 a b c d e f g h i = Row9 a b c d e f g h i
|
||||
@ -240,7 +240,7 @@ derive instance eqRow9 :: (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h, Eq i)
|
||||
derive instance ordRow9 :: (Ord a, Ord b, Ord c, Ord d, Ord e, Ord f, Ord g, Ord h, Ord i) => Ord (Row9 a b c d e f g h i)
|
||||
|
||||
instance showRow9 :: (Show a, Show b, Show c, Show d, Show e, Show f, Show g, Show h, Show i) => Show (Row9 a b c d e f g h i) where
|
||||
show (Row9 a b c d e f g h i) =
|
||||
show (Row9 a b c d e f g h i) =
|
||||
"(Row9 " <> show a <> " " <> show b <> " " <> show c <> " " <> show d <> " " <> show e <> " " <> show f <> " " <> show g <> " " <> show h <> " " <> show i <> ")"
|
||||
|
||||
instance fromSQLRowRow9 :: (FromSQLValue a, FromSQLValue b, FromSQLValue c, FromSQLValue d, FromSQLValue e, FromSQLValue f, FromSQLValue g, FromSQLValue h, FromSQLValue i) => FromSQLRow (Row9 a b c d e f g h i) where
|
||||
@ -259,7 +259,7 @@ instance fromSQLRowRow9 :: (FromSQLValue a, FromSQLValue b, FromSQLValue c, From
|
||||
where n = Array.length xs
|
||||
|
||||
instance toSQLRowRow9 :: (ToSQLValue a, ToSQLValue b, ToSQLValue c, ToSQLValue d, ToSQLValue e, ToSQLValue f, ToSQLValue g, ToSQLValue h, ToSQLValue i) => ToSQLRow (Row9 a b c d e f g h i) where
|
||||
toSQLRow (Row9 a b c d e f g h i) =
|
||||
toSQLRow (Row9 a b c d e f g h i) =
|
||||
[toSQLValue a, toSQLValue b, toSQLValue c, toSQLValue d, toSQLValue e, toSQLValue f, toSQLValue g, toSQLValue h, toSQLValue i]
|
||||
-- | A row with 10 fields.
|
||||
data Row10 a b c d e f g h i j = Row10 a b c d e f g h i j
|
||||
@ -269,7 +269,7 @@ derive instance eqRow10 :: (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h, Eq i
|
||||
derive instance ordRow10 :: (Ord a, Ord b, Ord c, Ord d, Ord e, Ord f, Ord g, Ord h, Ord i, Ord j) => Ord (Row10 a b c d e f g h i j)
|
||||
|
||||
instance showRow10 :: (Show a, Show b, Show c, Show d, Show e, Show f, Show g, Show h, Show i, Show j) => Show (Row10 a b c d e f g h i j) where
|
||||
show (Row10 a b c d e f g h i j) =
|
||||
show (Row10 a b c d e f g h i j) =
|
||||
"(Row10 " <> show a <> " " <> show b <> " " <> show c <> " " <> show d <> " " <> show e <> " " <> show f <> " " <> show g <> " " <> show h <> " " <> show i <> " " <> show j <> ")"
|
||||
|
||||
instance fromSQLRowRow10 :: (FromSQLValue a, FromSQLValue b, FromSQLValue c, FromSQLValue d, FromSQLValue e, FromSQLValue f, FromSQLValue g, FromSQLValue h, FromSQLValue i, FromSQLValue j) => FromSQLRow (Row10 a b c d e f g h i j) where
|
||||
@ -289,7 +289,7 @@ instance fromSQLRowRow10 :: (FromSQLValue a, FromSQLValue b, FromSQLValue c, Fro
|
||||
where n = Array.length xs
|
||||
|
||||
instance toSQLRowRow10 :: (ToSQLValue a, ToSQLValue b, ToSQLValue c, ToSQLValue d, ToSQLValue e, ToSQLValue f, ToSQLValue g, ToSQLValue h, ToSQLValue i, ToSQLValue j) => ToSQLRow (Row10 a b c d e f g h i j) where
|
||||
toSQLRow (Row10 a b c d e f g h i j) =
|
||||
toSQLRow (Row10 a b c d e f g h i j) =
|
||||
[toSQLValue a, toSQLValue b, toSQLValue c, toSQLValue d, toSQLValue e, toSQLValue f, toSQLValue g, toSQLValue h, toSQLValue i, toSQLValue j]
|
||||
-- | A row with 11 fields.
|
||||
data Row11 a b c d e f g h i j k = Row11 a b c d e f g h i j k
|
||||
@ -299,7 +299,7 @@ derive instance eqRow11 :: (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h, Eq i
|
||||
derive instance ordRow11 :: (Ord a, Ord b, Ord c, Ord d, Ord e, Ord f, Ord g, Ord h, Ord i, Ord j, Ord k) => Ord (Row11 a b c d e f g h i j k)
|
||||
|
||||
instance showRow11 :: (Show a, Show b, Show c, Show d, Show e, Show f, Show g, Show h, Show i, Show j, Show k) => Show (Row11 a b c d e f g h i j k) where
|
||||
show (Row11 a b c d e f g h i j k) =
|
||||
show (Row11 a b c d e f g h i j k) =
|
||||
"(Row11 " <> show a <> " " <> show b <> " " <> show c <> " " <> show d <> " " <> show e <> " " <> show f <> " " <> show g <> " " <> show h <> " " <> show i <> " " <> show j <> " " <> show k <> ")"
|
||||
|
||||
instance fromSQLRowRow11 :: (FromSQLValue a, FromSQLValue b, FromSQLValue c, FromSQLValue d, FromSQLValue e, FromSQLValue f, FromSQLValue g, FromSQLValue h, FromSQLValue i, FromSQLValue j, FromSQLValue k) => FromSQLRow (Row11 a b c d e f g h i j k) where
|
||||
@ -320,7 +320,7 @@ instance fromSQLRowRow11 :: (FromSQLValue a, FromSQLValue b, FromSQLValue c, Fro
|
||||
where n = Array.length xs
|
||||
|
||||
instance toSQLRowRow11 :: (ToSQLValue a, ToSQLValue b, ToSQLValue c, ToSQLValue d, ToSQLValue e, ToSQLValue f, ToSQLValue g, ToSQLValue h, ToSQLValue i, ToSQLValue j, ToSQLValue k) => ToSQLRow (Row11 a b c d e f g h i j k) where
|
||||
toSQLRow (Row11 a b c d e f g h i j k) =
|
||||
toSQLRow (Row11 a b c d e f g h i j k) =
|
||||
[toSQLValue a, toSQLValue b, toSQLValue c, toSQLValue d, toSQLValue e, toSQLValue f, toSQLValue g, toSQLValue h, toSQLValue i, toSQLValue j, toSQLValue k]
|
||||
-- | A row with 12 fields.
|
||||
data Row12 a b c d e f g h i j k l = Row12 a b c d e f g h i j k l
|
||||
@ -330,7 +330,7 @@ derive instance eqRow12 :: (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h, Eq i
|
||||
derive instance ordRow12 :: (Ord a, Ord b, Ord c, Ord d, Ord e, Ord f, Ord g, Ord h, Ord i, Ord j, Ord k, Ord l) => Ord (Row12 a b c d e f g h i j k l)
|
||||
|
||||
instance showRow12 :: (Show a, Show b, Show c, Show d, Show e, Show f, Show g, Show h, Show i, Show j, Show k, Show l) => Show (Row12 a b c d e f g h i j k l) where
|
||||
show (Row12 a b c d e f g h i j k l) =
|
||||
show (Row12 a b c d e f g h i j k l) =
|
||||
"(Row12 " <> show a <> " " <> show b <> " " <> show c <> " " <> show d <> " " <> show e <> " " <> show f <> " " <> show g <> " " <> show h <> " " <> show i <> " " <> show j <> " " <> show k <> " " <> show l <> ")"
|
||||
|
||||
instance fromSQLRowRow12 :: (FromSQLValue a, FromSQLValue b, FromSQLValue c, FromSQLValue d, FromSQLValue e, FromSQLValue f, FromSQLValue g, FromSQLValue h, FromSQLValue i, FromSQLValue j, FromSQLValue k, FromSQLValue l) => FromSQLRow (Row12 a b c d e f g h i j k l) where
|
||||
@ -352,7 +352,7 @@ instance fromSQLRowRow12 :: (FromSQLValue a, FromSQLValue b, FromSQLValue c, Fro
|
||||
where n = Array.length xs
|
||||
|
||||
instance toSQLRowRow12 :: (ToSQLValue a, ToSQLValue b, ToSQLValue c, ToSQLValue d, ToSQLValue e, ToSQLValue f, ToSQLValue g, ToSQLValue h, ToSQLValue i, ToSQLValue j, ToSQLValue k, ToSQLValue l) => ToSQLRow (Row12 a b c d e f g h i j k l) where
|
||||
toSQLRow (Row12 a b c d e f g h i j k l) =
|
||||
toSQLRow (Row12 a b c d e f g h i j k l) =
|
||||
[toSQLValue a, toSQLValue b, toSQLValue c, toSQLValue d, toSQLValue e, toSQLValue f, toSQLValue g, toSQLValue h, toSQLValue i, toSQLValue j, toSQLValue k, toSQLValue l]
|
||||
-- | A row with 13 fields.
|
||||
data Row13 a b c d e f g h i j k l m = Row13 a b c d e f g h i j k l m
|
||||
@ -362,7 +362,7 @@ derive instance eqRow13 :: (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h, Eq i
|
||||
derive instance ordRow13 :: (Ord a, Ord b, Ord c, Ord d, Ord e, Ord f, Ord g, Ord h, Ord i, Ord j, Ord k, Ord l, Ord m) => Ord (Row13 a b c d e f g h i j k l m)
|
||||
|
||||
instance showRow13 :: (Show a, Show b, Show c, Show d, Show e, Show f, Show g, Show h, Show i, Show j, Show k, Show l, Show m) => Show (Row13 a b c d e f g h i j k l m) where
|
||||
show (Row13 a b c d e f g h i j k l m) =
|
||||
show (Row13 a b c d e f g h i j k l m) =
|
||||
"(Row13 " <> show a <> " " <> show b <> " " <> show c <> " " <> show d <> " " <> show e <> " " <> show f <> " " <> show g <> " " <> show h <> " " <> show i <> " " <> show j <> " " <> show k <> " " <> show l <> " " <> show m <> ")"
|
||||
|
||||
instance fromSQLRowRow13 :: (FromSQLValue a, FromSQLValue b, FromSQLValue c, FromSQLValue d, FromSQLValue e, FromSQLValue f, FromSQLValue g, FromSQLValue h, FromSQLValue i, FromSQLValue j, FromSQLValue k, FromSQLValue l, FromSQLValue m) => FromSQLRow (Row13 a b c d e f g h i j k l m) where
|
||||
@ -385,7 +385,7 @@ instance fromSQLRowRow13 :: (FromSQLValue a, FromSQLValue b, FromSQLValue c, Fro
|
||||
where n = Array.length xs
|
||||
|
||||
instance toSQLRowRow13 :: (ToSQLValue a, ToSQLValue b, ToSQLValue c, ToSQLValue d, ToSQLValue e, ToSQLValue f, ToSQLValue g, ToSQLValue h, ToSQLValue i, ToSQLValue j, ToSQLValue k, ToSQLValue l, ToSQLValue m) => ToSQLRow (Row13 a b c d e f g h i j k l m) where
|
||||
toSQLRow (Row13 a b c d e f g h i j k l m) =
|
||||
toSQLRow (Row13 a b c d e f g h i j k l m) =
|
||||
[toSQLValue a, toSQLValue b, toSQLValue c, toSQLValue d, toSQLValue e, toSQLValue f, toSQLValue g, toSQLValue h, toSQLValue i, toSQLValue j, toSQLValue k, toSQLValue l, toSQLValue m]
|
||||
-- | A row with 14 fields.
|
||||
data Row14 a b c d e f g h i j k l m n = Row14 a b c d e f g h i j k l m n
|
||||
@ -395,7 +395,7 @@ derive instance eqRow14 :: (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h, Eq i
|
||||
derive instance ordRow14 :: (Ord a, Ord b, Ord c, Ord d, Ord e, Ord f, Ord g, Ord h, Ord i, Ord j, Ord k, Ord l, Ord m, Ord n) => Ord (Row14 a b c d e f g h i j k l m n)
|
||||
|
||||
instance showRow14 :: (Show a, Show b, Show c, Show d, Show e, Show f, Show g, Show h, Show i, Show j, Show k, Show l, Show m, Show n) => Show (Row14 a b c d e f g h i j k l m n) where
|
||||
show (Row14 a b c d e f g h i j k l m n) =
|
||||
show (Row14 a b c d e f g h i j k l m n) =
|
||||
"(Row14 " <> show a <> " " <> show b <> " " <> show c <> " " <> show d <> " " <> show e <> " " <> show f <> " " <> show g <> " " <> show h <> " " <> show i <> " " <> show j <> " " <> show k <> " " <> show l <> " " <> show m <> " " <> show n <> ")"
|
||||
|
||||
instance fromSQLRowRow14 :: (FromSQLValue a, FromSQLValue b, FromSQLValue c, FromSQLValue d, FromSQLValue e, FromSQLValue f, FromSQLValue g, FromSQLValue h, FromSQLValue i, FromSQLValue j, FromSQLValue k, FromSQLValue l, FromSQLValue m, FromSQLValue n) => FromSQLRow (Row14 a b c d e f g h i j k l m n) where
|
||||
@ -419,7 +419,7 @@ instance fromSQLRowRow14 :: (FromSQLValue a, FromSQLValue b, FromSQLValue c, Fro
|
||||
where n = Array.length xs
|
||||
|
||||
instance toSQLRowRow14 :: (ToSQLValue a, ToSQLValue b, ToSQLValue c, ToSQLValue d, ToSQLValue e, ToSQLValue f, ToSQLValue g, ToSQLValue h, ToSQLValue i, ToSQLValue j, ToSQLValue k, ToSQLValue l, ToSQLValue m, ToSQLValue n) => ToSQLRow (Row14 a b c d e f g h i j k l m n) where
|
||||
toSQLRow (Row14 a b c d e f g h i j k l m n) =
|
||||
toSQLRow (Row14 a b c d e f g h i j k l m n) =
|
||||
[toSQLValue a, toSQLValue b, toSQLValue c, toSQLValue d, toSQLValue e, toSQLValue f, toSQLValue g, toSQLValue h, toSQLValue i, toSQLValue j, toSQLValue k, toSQLValue l, toSQLValue m, toSQLValue n]
|
||||
-- | A row with 15 fields.
|
||||
data Row15 a b c d e f g h i j k l m n o = Row15 a b c d e f g h i j k l m n o
|
||||
@ -429,7 +429,7 @@ derive instance eqRow15 :: (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h, Eq i
|
||||
derive instance ordRow15 :: (Ord a, Ord b, Ord c, Ord d, Ord e, Ord f, Ord g, Ord h, Ord i, Ord j, Ord k, Ord l, Ord m, Ord n, Ord o) => Ord (Row15 a b c d e f g h i j k l m n o)
|
||||
|
||||
instance showRow15 :: (Show a, Show b, Show c, Show d, Show e, Show f, Show g, Show h, Show i, Show j, Show k, Show l, Show m, Show n, Show o) => Show (Row15 a b c d e f g h i j k l m n o) where
|
||||
show (Row15 a b c d e f g h i j k l m n o) =
|
||||
show (Row15 a b c d e f g h i j k l m n o) =
|
||||
"(Row15 " <> show a <> " " <> show b <> " " <> show c <> " " <> show d <> " " <> show e <> " " <> show f <> " " <> show g <> " " <> show h <> " " <> show i <> " " <> show j <> " " <> show k <> " " <> show l <> " " <> show m <> " " <> show n <> " " <> show o <> ")"
|
||||
|
||||
instance fromSQLRowRow15 :: (FromSQLValue a, FromSQLValue b, FromSQLValue c, FromSQLValue d, FromSQLValue e, FromSQLValue f, FromSQLValue g, FromSQLValue h, FromSQLValue i, FromSQLValue j, FromSQLValue k, FromSQLValue l, FromSQLValue m, FromSQLValue n, FromSQLValue o) => FromSQLRow (Row15 a b c d e f g h i j k l m n o) where
|
||||
@ -454,7 +454,7 @@ instance fromSQLRowRow15 :: (FromSQLValue a, FromSQLValue b, FromSQLValue c, Fro
|
||||
where n = Array.length xs
|
||||
|
||||
instance toSQLRowRow15 :: (ToSQLValue a, ToSQLValue b, ToSQLValue c, ToSQLValue d, ToSQLValue e, ToSQLValue f, ToSQLValue g, ToSQLValue h, ToSQLValue i, ToSQLValue j, ToSQLValue k, ToSQLValue l, ToSQLValue m, ToSQLValue n, ToSQLValue o) => ToSQLRow (Row15 a b c d e f g h i j k l m n o) where
|
||||
toSQLRow (Row15 a b c d e f g h i j k l m n o) =
|
||||
toSQLRow (Row15 a b c d e f g h i j k l m n o) =
|
||||
[toSQLValue a, toSQLValue b, toSQLValue c, toSQLValue d, toSQLValue e, toSQLValue f, toSQLValue g, toSQLValue h, toSQLValue i, toSQLValue j, toSQLValue k, toSQLValue l, toSQLValue m, toSQLValue n, toSQLValue o]
|
||||
-- | A row with 16 fields.
|
||||
data Row16 a b c d e f g h i j k l m n o p = Row16 a b c d e f g h i j k l m n o p
|
||||
@ -464,7 +464,7 @@ derive instance eqRow16 :: (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h, Eq i
|
||||
derive instance ordRow16 :: (Ord a, Ord b, Ord c, Ord d, Ord e, Ord f, Ord g, Ord h, Ord i, Ord j, Ord k, Ord l, Ord m, Ord n, Ord o, Ord p) => Ord (Row16 a b c d e f g h i j k l m n o p)
|
||||
|
||||
instance showRow16 :: (Show a, Show b, Show c, Show d, Show e, Show f, Show g, Show h, Show i, Show j, Show k, Show l, Show m, Show n, Show o, Show p) => Show (Row16 a b c d e f g h i j k l m n o p) where
|
||||
show (Row16 a b c d e f g h i j k l m n o p) =
|
||||
show (Row16 a b c d e f g h i j k l m n o p) =
|
||||
"(Row16 " <> show a <> " " <> show b <> " " <> show c <> " " <> show d <> " " <> show e <> " " <> show f <> " " <> show g <> " " <> show h <> " " <> show i <> " " <> show j <> " " <> show k <> " " <> show l <> " " <> show m <> " " <> show n <> " " <> show o <> " " <> show p <> ")"
|
||||
|
||||
instance fromSQLRowRow16 :: (FromSQLValue a, FromSQLValue b, FromSQLValue c, FromSQLValue d, FromSQLValue e, FromSQLValue f, FromSQLValue g, FromSQLValue h, FromSQLValue i, FromSQLValue j, FromSQLValue k, FromSQLValue l, FromSQLValue m, FromSQLValue n, FromSQLValue o, FromSQLValue p) => FromSQLRow (Row16 a b c d e f g h i j k l m n o p) where
|
||||
@ -490,7 +490,7 @@ instance fromSQLRowRow16 :: (FromSQLValue a, FromSQLValue b, FromSQLValue c, Fro
|
||||
where n = Array.length xs
|
||||
|
||||
instance toSQLRowRow16 :: (ToSQLValue a, ToSQLValue b, ToSQLValue c, ToSQLValue d, ToSQLValue e, ToSQLValue f, ToSQLValue g, ToSQLValue h, ToSQLValue i, ToSQLValue j, ToSQLValue k, ToSQLValue l, ToSQLValue m, ToSQLValue n, ToSQLValue o, ToSQLValue p) => ToSQLRow (Row16 a b c d e f g h i j k l m n o p) where
|
||||
toSQLRow (Row16 a b c d e f g h i j k l m n o p) =
|
||||
toSQLRow (Row16 a b c d e f g h i j k l m n o p) =
|
||||
[toSQLValue a, toSQLValue b, toSQLValue c, toSQLValue d, toSQLValue e, toSQLValue f, toSQLValue g, toSQLValue h, toSQLValue i, toSQLValue j, toSQLValue k, toSQLValue l, toSQLValue m, toSQLValue n, toSQLValue o, toSQLValue p]
|
||||
-- | A row with 17 fields.
|
||||
data Row17 a b c d e f g h i j k l m n o p q = Row17 a b c d e f g h i j k l m n o p q
|
||||
@ -500,7 +500,7 @@ derive instance eqRow17 :: (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h, Eq i
|
||||
derive instance ordRow17 :: (Ord a, Ord b, Ord c, Ord d, Ord e, Ord f, Ord g, Ord h, Ord i, Ord j, Ord k, Ord l, Ord m, Ord n, Ord o, Ord p, Ord q) => Ord (Row17 a b c d e f g h i j k l m n o p q)
|
||||
|
||||
instance showRow17 :: (Show a, Show b, Show c, Show d, Show e, Show f, Show g, Show h, Show i, Show j, Show k, Show l, Show m, Show n, Show o, Show p, Show q) => Show (Row17 a b c d e f g h i j k l m n o p q) where
|
||||
show (Row17 a b c d e f g h i j k l m n o p q) =
|
||||
show (Row17 a b c d e f g h i j k l m n o p q) =
|
||||
"(Row17 " <> show a <> " " <> show b <> " " <> show c <> " " <> show d <> " " <> show e <> " " <> show f <> " " <> show g <> " " <> show h <> " " <> show i <> " " <> show j <> " " <> show k <> " " <> show l <> " " <> show m <> " " <> show n <> " " <> show o <> " " <> show p <> " " <> show q <> ")"
|
||||
|
||||
instance fromSQLRowRow17 :: (FromSQLValue a, FromSQLValue b, FromSQLValue c, FromSQLValue d, FromSQLValue e, FromSQLValue f, FromSQLValue g, FromSQLValue h, FromSQLValue i, FromSQLValue j, FromSQLValue k, FromSQLValue l, FromSQLValue m, FromSQLValue n, FromSQLValue o, FromSQLValue p, FromSQLValue q) => FromSQLRow (Row17 a b c d e f g h i j k l m n o p q) where
|
||||
@ -527,7 +527,7 @@ instance fromSQLRowRow17 :: (FromSQLValue a, FromSQLValue b, FromSQLValue c, Fro
|
||||
where n = Array.length xs
|
||||
|
||||
instance toSQLRowRow17 :: (ToSQLValue a, ToSQLValue b, ToSQLValue c, ToSQLValue d, ToSQLValue e, ToSQLValue f, ToSQLValue g, ToSQLValue h, ToSQLValue i, ToSQLValue j, ToSQLValue k, ToSQLValue l, ToSQLValue m, ToSQLValue n, ToSQLValue o, ToSQLValue p, ToSQLValue q) => ToSQLRow (Row17 a b c d e f g h i j k l m n o p q) where
|
||||
toSQLRow (Row17 a b c d e f g h i j k l m n o p q) =
|
||||
toSQLRow (Row17 a b c d e f g h i j k l m n o p q) =
|
||||
[toSQLValue a, toSQLValue b, toSQLValue c, toSQLValue d, toSQLValue e, toSQLValue f, toSQLValue g, toSQLValue h, toSQLValue i, toSQLValue j, toSQLValue k, toSQLValue l, toSQLValue m, toSQLValue n, toSQLValue o, toSQLValue p, toSQLValue q]
|
||||
-- | A row with 18 fields.
|
||||
data Row18 a b c d e f g h i j k l m n o p q r = Row18 a b c d e f g h i j k l m n o p q r
|
||||
@ -537,7 +537,7 @@ derive instance eqRow18 :: (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h, Eq i
|
||||
derive instance ordRow18 :: (Ord a, Ord b, Ord c, Ord d, Ord e, Ord f, Ord g, Ord h, Ord i, Ord j, Ord k, Ord l, Ord m, Ord n, Ord o, Ord p, Ord q, Ord r) => Ord (Row18 a b c d e f g h i j k l m n o p q r)
|
||||
|
||||
instance showRow18 :: (Show a, Show b, Show c, Show d, Show e, Show f, Show g, Show h, Show i, Show j, Show k, Show l, Show m, Show n, Show o, Show p, Show q, Show r) => Show (Row18 a b c d e f g h i j k l m n o p q r) where
|
||||
show (Row18 a b c d e f g h i j k l m n o p q r) =
|
||||
show (Row18 a b c d e f g h i j k l m n o p q r) =
|
||||
"(Row18 " <> show a <> " " <> show b <> " " <> show c <> " " <> show d <> " " <> show e <> " " <> show f <> " " <> show g <> " " <> show h <> " " <> show i <> " " <> show j <> " " <> show k <> " " <> show l <> " " <> show m <> " " <> show n <> " " <> show o <> " " <> show p <> " " <> show q <> " " <> show r <> ")"
|
||||
|
||||
instance fromSQLRowRow18 :: (FromSQLValue a, FromSQLValue b, FromSQLValue c, FromSQLValue d, FromSQLValue e, FromSQLValue f, FromSQLValue g, FromSQLValue h, FromSQLValue i, FromSQLValue j, FromSQLValue k, FromSQLValue l, FromSQLValue m, FromSQLValue n, FromSQLValue o, FromSQLValue p, FromSQLValue q, FromSQLValue r) => FromSQLRow (Row18 a b c d e f g h i j k l m n o p q r) where
|
||||
@ -565,7 +565,7 @@ instance fromSQLRowRow18 :: (FromSQLValue a, FromSQLValue b, FromSQLValue c, Fro
|
||||
where n = Array.length xs
|
||||
|
||||
instance toSQLRowRow18 :: (ToSQLValue a, ToSQLValue b, ToSQLValue c, ToSQLValue d, ToSQLValue e, ToSQLValue f, ToSQLValue g, ToSQLValue h, ToSQLValue i, ToSQLValue j, ToSQLValue k, ToSQLValue l, ToSQLValue m, ToSQLValue n, ToSQLValue o, ToSQLValue p, ToSQLValue q, ToSQLValue r) => ToSQLRow (Row18 a b c d e f g h i j k l m n o p q r) where
|
||||
toSQLRow (Row18 a b c d e f g h i j k l m n o p q r) =
|
||||
toSQLRow (Row18 a b c d e f g h i j k l m n o p q r) =
|
||||
[toSQLValue a, toSQLValue b, toSQLValue c, toSQLValue d, toSQLValue e, toSQLValue f, toSQLValue g, toSQLValue h, toSQLValue i, toSQLValue j, toSQLValue k, toSQLValue l, toSQLValue m, toSQLValue n, toSQLValue o, toSQLValue p, toSQLValue q, toSQLValue r]
|
||||
-- | A row with 19 fields.
|
||||
data Row19 a b c d e f g h i j k l m n o p q r s = Row19 a b c d e f g h i j k l m n o p q r s
|
||||
@ -575,7 +575,7 @@ derive instance eqRow19 :: (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h, Eq i
|
||||
derive instance ordRow19 :: (Ord a, Ord b, Ord c, Ord d, Ord e, Ord f, Ord g, Ord h, Ord i, Ord j, Ord k, Ord l, Ord m, Ord n, Ord o, Ord p, Ord q, Ord r, Ord s) => Ord (Row19 a b c d e f g h i j k l m n o p q r s)
|
||||
|
||||
instance showRow19 :: (Show a, Show b, Show c, Show d, Show e, Show f, Show g, Show h, Show i, Show j, Show k, Show l, Show m, Show n, Show o, Show p, Show q, Show r, Show s) => Show (Row19 a b c d e f g h i j k l m n o p q r s) where
|
||||
show (Row19 a b c d e f g h i j k l m n o p q r s) =
|
||||
show (Row19 a b c d e f g h i j k l m n o p q r s) =
|
||||
"(Row19 " <> show a <> " " <> show b <> " " <> show c <> " " <> show d <> " " <> show e <> " " <> show f <> " " <> show g <> " " <> show h <> " " <> show i <> " " <> show j <> " " <> show k <> " " <> show l <> " " <> show m <> " " <> show n <> " " <> show o <> " " <> show p <> " " <> show q <> " " <> show r <> " " <> show s <> ")"
|
||||
|
||||
instance fromSQLRowRow19 :: (FromSQLValue a, FromSQLValue b, FromSQLValue c, FromSQLValue d, FromSQLValue e, FromSQLValue f, FromSQLValue g, FromSQLValue h, FromSQLValue i, FromSQLValue j, FromSQLValue k, FromSQLValue l, FromSQLValue m, FromSQLValue n, FromSQLValue o, FromSQLValue p, FromSQLValue q, FromSQLValue r, FromSQLValue s) => FromSQLRow (Row19 a b c d e f g h i j k l m n o p q r s) where
|
||||
@ -604,5 +604,5 @@ instance fromSQLRowRow19 :: (FromSQLValue a, FromSQLValue b, FromSQLValue c, Fro
|
||||
where n = Array.length xs
|
||||
|
||||
instance toSQLRowRow19 :: (ToSQLValue a, ToSQLValue b, ToSQLValue c, ToSQLValue d, ToSQLValue e, ToSQLValue f, ToSQLValue g, ToSQLValue h, ToSQLValue i, ToSQLValue j, ToSQLValue k, ToSQLValue l, ToSQLValue m, ToSQLValue n, ToSQLValue o, ToSQLValue p, ToSQLValue q, ToSQLValue r, ToSQLValue s) => ToSQLRow (Row19 a b c d e f g h i j k l m n o p q r s) where
|
||||
toSQLRow (Row19 a b c d e f g h i j k l m n o p q r s) =
|
||||
toSQLRow (Row19 a b c d e f g h i j k l m n o p q r s) =
|
||||
[toSQLValue a, toSQLValue b, toSQLValue c, toSQLValue d, toSQLValue e, toSQLValue f, toSQLValue g, toSQLValue h, toSQLValue i, toSQLValue j, toSQLValue k, toSQLValue l, toSQLValue m, toSQLValue n, toSQLValue o, toSQLValue p, toSQLValue q, toSQLValue r, toSQLValue s]
|
||||
|
@ -2,7 +2,6 @@ module Database.PostgreSQL.Value where
|
||||
|
||||
import Prelude
|
||||
|
||||
import Control.Monad.Eff (kind Effect)
|
||||
import Control.Monad.Error.Class (throwError)
|
||||
import Control.Monad.Except (runExcept)
|
||||
import Data.Array as Array
|
||||
@ -14,7 +13,7 @@ import Data.Decimal (Decimal)
|
||||
import Data.Decimal as Decimal
|
||||
import Data.Either (Either(..), note)
|
||||
import Data.Enum (fromEnum, toEnum)
|
||||
import Data.Foreign (Foreign, isNull, readArray, readBoolean, readChar, readInt, readNumber, readString, toForeign, unsafeFromForeign)
|
||||
import Foreign (Foreign, isNull, readArray, readBoolean, readChar, readInt, readNumber, readString, unsafeToForeign, unsafeFromForeign)
|
||||
import Data.Int (fromString)
|
||||
import Data.List (List)
|
||||
import Data.List as List
|
||||
@ -32,49 +31,49 @@ class FromSQLValue a where
|
||||
fromSQLValue :: Foreign -> Either String a
|
||||
|
||||
instance toSQLValueBoolean :: ToSQLValue Boolean where
|
||||
toSQLValue = toForeign
|
||||
toSQLValue = unsafeToForeign
|
||||
|
||||
instance fromSQLValueBoolean :: FromSQLValue Boolean where
|
||||
fromSQLValue = lmap show <<< runExcept <<< readBoolean
|
||||
|
||||
instance toSQLValueChar :: ToSQLValue Char where
|
||||
toSQLValue = toForeign
|
||||
toSQLValue = unsafeToForeign
|
||||
|
||||
instance fromSQLValueChar :: FromSQLValue Char where
|
||||
fromSQLValue = lmap show <<< runExcept <<< readChar
|
||||
|
||||
instance toSQLValueInt :: ToSQLValue Int where
|
||||
toSQLValue = toForeign
|
||||
toSQLValue = unsafeToForeign
|
||||
|
||||
instance fromSQLValueInt :: FromSQLValue Int where
|
||||
fromSQLValue = lmap show <<< runExcept <<< readInt
|
||||
|
||||
instance toSQLValueNumber :: ToSQLValue Number where
|
||||
toSQLValue = toForeign
|
||||
toSQLValue = unsafeToForeign
|
||||
|
||||
instance fromSQLValueNumber :: FromSQLValue Number where
|
||||
fromSQLValue = lmap show <<< runExcept <<< readNumber
|
||||
|
||||
instance toSQLValueString :: ToSQLValue String where
|
||||
toSQLValue = toForeign
|
||||
toSQLValue = unsafeToForeign
|
||||
|
||||
instance fromSQLValueString :: FromSQLValue String where
|
||||
fromSQLValue = lmap show <<< runExcept <<< readString
|
||||
|
||||
instance toSQLValueArray :: (ToSQLValue a) => ToSQLValue (Array a) where
|
||||
toSQLValue = toForeign <<< map toSQLValue
|
||||
toSQLValue = unsafeToForeign <<< map toSQLValue
|
||||
|
||||
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 <<< Array.fromFoldable <<< map toSQLValue
|
||||
toSQLValue = unsafeToForeign <<< 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
|
||||
toSQLValue = unsafeToForeign
|
||||
|
||||
instance fromSQLValueByteString :: FromSQLValue ByteString where
|
||||
fromSQLValue x
|
||||
@ -96,7 +95,7 @@ instance toSQLValueDate :: ToSQLValue Date where
|
||||
m = fromEnum $ month date
|
||||
d = fromEnum $ day date
|
||||
in
|
||||
toForeign $ show y <> "-" <> show m <> "-" <> show d
|
||||
unsafeToForeign $ show y <> "-" <> show m <> "-" <> show d
|
||||
|
||||
instance fromSQLValueDate :: FromSQLValue Date where
|
||||
fromSQLValue v = do
|
||||
@ -122,13 +121,13 @@ instance fromSQLValueMaybe :: (FromSQLValue a) => FromSQLValue (Maybe a) where
|
||||
| otherwise = Just <$> fromSQLValue x
|
||||
|
||||
instance toSQLValueForeign :: ToSQLValue Foreign where
|
||||
toSQLValue = id
|
||||
toSQLValue = identity
|
||||
|
||||
instance fromSQLValueForeign :: FromSQLValue Foreign where
|
||||
fromSQLValue = pure
|
||||
|
||||
instance toSQLValueDecimal :: ToSQLValue Decimal where
|
||||
toSQLValue = Decimal.toString >>> toForeign
|
||||
toSQLValue = Decimal.toString >>> unsafeToForeign
|
||||
|
||||
instance fromSQLValueDecimal :: FromSQLValue Decimal where
|
||||
fromSQLValue v = do
|
||||
|
Loading…
Reference in New Issue
Block a user