Module

Selda

Package
purescript-selda
Repository
Kamirus/purescript-selda

#(.==) Source

Operator alias for Selda.expEq (left-associative / precedence 4)

#expEq Source

expEq :: forall a s. Col s a -> Col s a -> Col s Boolean

#(.>) Source

Operator alias for Selda.expGt (left-associative / precedence 4)

#expGt Source

expGt :: forall a s. Col s a -> Col s a -> Col s Boolean

#(.||) Source

Operator alias for Selda.expOr (right-associative / precedence 2)

#expOr Source

expOr :: forall s. Col s Boolean -> Col s Boolean -> Col s Boolean

#count Source

count :: forall a s. Col s a -> Aggr s String

returns String because the value might not fit in the underlying js float

#max_ Source

max_ :: forall a s. Col s a -> Aggr s (Maybe a)

returns Maybe in case of empty set aggregation

#sum_ Source

sum_ :: forall a s. Col s a -> Aggr s (Maybe String)

#not_ Source

not_ :: forall s. Col s Boolean -> Col s Boolean

#inArray Source

inArray :: forall a s. Col s a -> Array (Col s a) -> Col s Boolean

Re-exports from Selda.Col

#Col Source

newtype Col s a

Constructors

Instances

#Lit Source

class Lit a  where

Members

Instances

Re-exports from Selda.PG

#showUpdate Source

showUpdate :: forall r' s r. TableToColsWithoutAlias r r' => GetCols r' => Table r -> (Record r' -> Col s Boolean) -> (Record r' -> Record r') -> String

#showQuery Source

showQuery :: forall s i. GetCols i => FullQuery s (Record i) -> String

#showInsert1 Source

showInsert1 :: forall rlcols t. CanInsertColumnsIntoTable rlcols t => TableColumnNames rlcols => RowListLength rlcols => Table t -> RLProxy rlcols -> String

#showDeleteFrom Source

showDeleteFrom :: forall r' s r. TableToColsWithoutAlias r r' => Table r -> (Record r' -> Col s Boolean) -> String

Re-exports from Selda.PG.Class

#update Source

update :: forall m r' s r. TableToColsWithoutAlias r r' => GetCols r' => MonadSelda m => Table r -> (Record r' -> Col s Boolean) -> (Record r' -> Record r') -> m Unit

#query Source

query :: forall m s tup i o. ColsToPGHandler s i tup o => GetCols i => FromSQLRow tup => MonadSelda m => FullQuery s (Record i) -> m (Array (Record o))

#insert_ Source

insert_ :: forall m tup rlcols t r. RowToList r rlcols => CanInsertColumnsIntoTable rlcols t => TableColumnNames rlcols => RowListLength rlcols => FromSQLRow tup => ToSQLRow tup => MkTupleToRecord tup r => HFoldl RecordToTuple Unit (Record r) tup => MonadSelda m => Table t -> Array (Record r) -> m Unit

Executes an insert query for each input record.

#insert Source

insert :: forall m tup rlcols t r. RowToList r rlcols => CanInsertColumnsIntoTable rlcols t => TableColumnNames rlcols => RowListLength rlcols => FromSQLRow tup => ToSQLRow tup => MkTupleToRecord tup r => HFoldl RecordToTuple Unit (Record r) tup => MonadSelda m => Table t -> Array (Record r) -> m (Array (Record r))

Executes an insert query for each input record. Records to be inserted needs to have columns without constraints, Default ale optional, Auto must be missing

#deleteFrom Source

deleteFrom :: forall m r' s r. TableToColsWithoutAlias r r' => MonadSelda m => Table r -> (Record r' -> Col s Boolean) -> m Unit

Re-exports from Selda.Query

#selectFrom_ Source

selectFrom_ :: forall reso resi s inner. FromSubQuery s inner resi => FullQuery (Inner s) (Record inner) -> (Record resi -> Query s (Record reso)) -> FullQuery s (Record reso)

#selectFrom Source

selectFrom :: forall res cols s r. FromTable s r cols => Table r -> (Record cols -> Query s (Record res)) -> FullQuery s (Record res)

#restrict Source

restrict :: forall s. Col s Boolean -> Query s Unit

#orderBy Source

orderBy :: forall a s. Order -> Col s a -> Query s Unit

#notNull Source

notNull :: forall a s. Col s (Maybe a) -> Query s (Col s a)

#limit Source

limit :: forall s. Int -> Query s Unit

#leftJoin_ Source

leftJoin_ :: forall inner mres res s. FromSubQuery s inner res => HMap WrapWithMaybe (Record res) (Record mres) => (Record res -> Col s Boolean) -> FullQuery (Inner s) (Record inner) -> Query s (Record mres)

leftJoin_ on q run sub query q; with this execute on to get JOIN constraint; add sub query to sources; return previously mapped record with each value in Col wrapped in Maybe (because LEFT JOIN can return null for each column)

#leftJoin Source

leftJoin :: forall mres res s r. FromTable s r res => HMap WrapWithMaybe (Record res) (Record mres) => Table r -> (Record res -> Col s Boolean) -> Query s (Record mres)

#groupBy' Source

groupBy' :: forall s o i. GetCols i => HMap WrapWithAggr (Record i) (Record o) => Record i -> Query s (Record o)

#groupBy Source

groupBy :: forall a s. Col s a -> Query s (Aggr s a)

#crossJoin_ Source

crossJoin_ :: forall res s inner. FromSubQuery s inner res => FullQuery (Inner s) (Record inner) -> Query s (Record res)

#crossJoin Source

crossJoin :: forall res r s. FromTable s r res => Table r -> Query s (Record res)

#aggregate Source

aggregate :: forall res aggr s. HMapWithIndex UnAggr (Record aggr) (Record res) => FullQuery s (Record aggr) -> FullQuery s (Record res)

Re-exports from Selda.Query.Type

#Query Source

newtype Query s a

Represents an intermediate query state. Before being wrapped with FullQuery this state represents SQL query without FROM component, but having every other including JOIN[s]

Constructors

Instances

#FullQuery Source

newtype FullQuery s a

wrapper for query that is ready for SQL generation This could be simple record { head ∷ SQL, st ∷ GenState } where st is state from wrapped query

Constructors

Instances

Re-exports from Selda.Table

#Table Source

newtype Table (r :: Row Type)

Constructors