generated from tpl/purs
feat: isReferenced
This commit is contained in:
parent
2eba8bd07f
commit
30fff94a26
@ -10,6 +10,7 @@ package:
|
||||
- effect
|
||||
- either
|
||||
- exceptions
|
||||
- foldable-traversable
|
||||
- foreign
|
||||
- fork
|
||||
- maybe
|
||||
|
@ -2,8 +2,9 @@ module Data.Postgres.Query.Builder where
|
||||
|
||||
import Prelude
|
||||
|
||||
import Control.Monad.State (StateT, modify, runStateT)
|
||||
import Control.Monad.State (StateT, get, modify, runStateT)
|
||||
import Data.Array as Array
|
||||
import Data.Foldable (any, elem)
|
||||
import Data.Set (Set)
|
||||
import Data.Set as Set
|
||||
import Data.Tuple.Nested (type (/\))
|
||||
@ -18,6 +19,11 @@ runBuilder = flip runStateT { params: [], refs: Set.empty }
|
||||
reference :: forall m. Monad m => String -> BuilderT m Unit
|
||||
reference k = void $ modify (\s@{ refs } -> s { refs = Set.insert k refs })
|
||||
|
||||
isReferenced :: forall m. Monad m => Array String -> BuilderT m Boolean
|
||||
isReferenced ts = do
|
||||
{ refs } <- get
|
||||
pure $ any (flip elem ts) refs
|
||||
|
||||
param :: forall m a. Monad m => ToSQLValue a => a -> BuilderT m String
|
||||
param p =
|
||||
do
|
||||
|
Loading…
Reference in New Issue
Block a user