Droplet.Language
- Package
- purescript-droplet
- Repository
- easafe/purescript-droplet
Query language
Re-exports from Droplet.Language.Internal.Condition
#Op Source
data Op b c
Wrapper for comparisons
Instances
(ToCondition (Op a b) fields alias, ToCondition (Op c d) fields alias) => ToCondition (Op (Op a b) (Op c d)) fields alias
ToCondition (Op Exists b) fields alias
(Cons name t d fields, IsNullable t) => ToCondition (Op IsNull (Proxy name)) fields alias
(Cons name t d fields, IsNullable t) => ToCondition (Op IsNull (Path alias name)) fields alias
ToCondition (Op IsNull (Path table name)) fields alias
(Cons name t d fields, IsNullable t) => ToCondition (Op IsNotNull (Proxy name)) fields alias
(Cons name t d fields, IsNullable t) => ToCondition (Op IsNotNull (Path alias name)) fields alias
ToCondition (Op IsNotNull (Path table name)) fields alias
(ToCondition a fields alias) => ToCondition (Op Not a) fields alias
(ToCondition (Op a b) fields alias) => ToCondition (Op In (Op a (NonEmptyArray b))) fields alias
(Comparison a fields alias t, Comparison b fields alias u, ValidComparision t u) => ToCondition (Op a b) fields alias
#In Source
data In
Instances
(ToCondition (Op a b) fields alias) => ToCondition (Op In (Op a (NonEmptyArray b))) fields alias
#lesserThan Source
lesserThan :: forall compared field. field -> compared -> Op field compared
#lesserEqualsThan Source
lesserEqualsThan :: forall compared field. field -> compared -> Op field compared
#greaterThan Source
greaterThan :: forall compared field. field -> compared -> Op field compared
#greaterEqualsThan Source
greaterEqualsThan :: forall compared field. field -> compared -> Op field compared
#(.||.) Source
Operator alias for Droplet.Language.Internal.Condition.or (left-associative / precedence 2)
#(.>=.) Source
Operator alias for Droplet.Language.Internal.Condition.greaterEqualsThan (non-associative / precedence 4)
#(.>.) Source
Operator alias for Droplet.Language.Internal.Condition.greaterThan (non-associative / precedence 4)
#(.=.) Source
Operator alias for Droplet.Language.Internal.Condition.equals (non-associative / precedence 4)
#(.<>.) Source
Operator alias for Droplet.Language.Internal.Condition.notEquals (non-associative / precedence 4)
#(.<=.) Source
Operator alias for Droplet.Language.Internal.Condition.lesserEqualsThan (non-associative / precedence 4)
#(.<.) Source
Operator alias for Droplet.Language.Internal.Condition.lesserThan (non-associative / precedence 4)
#(.&&.) Source
Operator alias for Droplet.Language.Internal.Condition.and (left-associative / precedence 3)
Re-exports from Droplet.Language.Internal.Definition
#PrimaryKey Source
data PrimaryKey
#ForeignKey Source
data ForeignKey :: Symbol -> Type -> Type
data ForeignKey (field :: Symbol) (table :: Type)
#Constraint Source
data Constraint :: forall n. n -> Type -> Type
data Constraint name t
#Column Source
data Column (t :: Type) (constraint :: Type)
Constructors
Instances
UnwrapDefinition (Column t c) t
IsNullable (Column (Maybe t) c)
#ToParameters Source
class ToParameters :: Row Type -> RowList Type -> Constraint
class ToParameters record (list :: RowList Type)
Instances
ToParameters record Nil
(IsSymbol name, Reflectable name String, ToValue t, Cons name t e record, ToParameters record rest) => ToParameters record (Cons name t rest)
#(...) Source
Operator alias for Droplet.Language.Internal.Definition.path (non-associative / precedence 7)
Re-exports from Droplet.Language.Internal.Function
#FunctionSignature' Source
type FunctionSignature' output = forall fields. PgFunction Void Unit fields output
#FunctionSignature Source
type FunctionSignature input output = forall args fields. MatchArgumentList input args fields => args -> PgFunction input args fields output
#string_agg Source
string_agg :: forall f rest fields. ToStringAgg f rest fields => f -> rest -> Aggregate f rest fields (Maybe String)
#function' Source
function' :: forall output. String -> FunctionSignature' output
Represents a function that takes no arguments
#function Source
function :: forall input output. String -> FunctionSignature input output
Represents a function that takes arguments
#coalesce Source
coalesce :: forall input output fields. ToCoalesce input fields output => input -> PgFunction input input fields (Maybe output)
Re-exports from Droplet.Language.Internal.Syntax
#Where Source
data Where c rest
Instances
(LimitedResults rest) => LimitedResults (Where c rest)
(GroupBySource f columns) => ToGroupBy (Select s p (From f fd (Where cond E))) s columns
(SortColumnsSource s projection f columns available, SortColumns st available) => ToOrderBy st (Select s projection (From f columns (Where cd E)))
(GroupedColumns g columns grouped, Union projection grouped pg, Nub pg available, SortColumns st available) => ToOrderBy st (Select s projection (From f columns (Where cd (GroupBy g E))))
ToLimit (Select s projection (From fr fields (Where cd (OrderBy f E))))
ToLimit (Select s projection (From fr fields (Where cd (OrderBy f (Offset E)))))
ToLimit (Select s projection (From fr fields (Where cd (GroupBy fg (OrderBy f E)))))
ToLimit (Select s projection (From fr fields (Where cd (GroupBy fg (OrderBy f (Offset E))))))
ToOffset (Select s projection (From fr fields (Where cd (OrderBy f E))))
ToOffset (Select s projection (From fr fields (Where cd (OrderBy f (Limit n E)))))
ToOffset (Select s projection (From fr fields (Where cd (GroupBy fg (OrderBy f E)))))
ToOffset (Select s projection (From fr fields (Where cd (GroupBy fg (OrderBy f (Limit n E))))))
(QueryMustBeAliased rest alias) => QueryMustBeAliased (Where cd rest) alias
(QueryOptionallyAliased rest name alias) => QueryOptionallyAliased (Where cd rest) name alias
(Resume rest b c) => Resume (Where cd rest) b (Where cd c)
#Select Source
data Select :: Type -> Row Type -> Type -> Type
data Select s (projection :: Row Type) rest
SELECT representation. projection
refers to the final output of this statement
Instances
ToPrepare (Select s p (From f fields rest))
(ToSubExpression f, LimitedResults rest) => ToSelect (Select f projection rest)
(ToProjection s fields aliases selected, Nub selected unique, UniqueColumnNames selected unique) => ToFrom (Join k fields l r aliases (On c rest)) (Select s unique E) fields
(SourceColumns f fields aliases, ToProjection s fields aliases selected, Nub selected unique, UniqueColumnNames selected unique) => ToFrom f (Select s unique E) fields
(SourceAlias f alias, ToCondition c fields alias) => ToWhere c (Select s projection (From f fields E))
(GroupBySource f columns) => ToGroupBy (Select s p (From f fd E)) s columns
(GroupBySource f columns) => ToGroupBy (Select s p (From f fd (Where cond E))) s columns
(QueryMustBeAliased rest alias, RowToList projection list, QualifiedColumns list alias aliased, Union aliased projection all) => GroupBySource (Select s projection (From f fd rest)) all
ToAs (Select s p (From f fields rest)) alias
(SortColumnsSource s projection f columns available, SortColumns st available) => ToOrderBy st (Select s projection (From f columns E))
(GroupedColumns g columns grouped, Union projection grouped pg, Nub pg available, SortColumns st available) => ToOrderBy st (Select s projection (From f columns (GroupBy g E)))
(SortColumnsSource s projection f columns available, SortColumns st available) => ToOrderBy st (Select s projection (From f columns (Where cd E)))
(GroupedColumns g columns grouped, Union projection grouped pg, Nub pg available, SortColumns st available) => ToOrderBy st (Select s projection (From f columns (Where cd (GroupBy g E))))
ToLimit (Select s projection (From fr fields (OrderBy f E)))
ToLimit (Select s projection (From fr fields (OrderBy f (Offset E))))
ToLimit (Select s projection (From fr fields (GroupBy fg (OrderBy f E))))
ToLimit (Select s projection (From fr fields (GroupBy fg (OrderBy f (Offset E)))))
ToLimit (Select s projection (From fr fields (Where cd (OrderBy f E))))
ToLimit (Select s projection (From fr fields (Where cd (OrderBy f (Offset E)))))
ToLimit (Select s projection (From fr fields (Where cd (GroupBy fg (OrderBy f E)))))
ToLimit (Select s projection (From fr fields (Where cd (GroupBy fg (OrderBy f (Offset E))))))
ToOffset (Select s projection (From fr fields (OrderBy f E)))
ToOffset (Select s projection (From fr fields (OrderBy f (Limit n E))))
ToOffset (Select s projection (From fr fields (GroupBy fg (OrderBy f E))))
ToOffset (Select s projection (From fr fields (GroupBy fg (OrderBy f (Limit n E)))))
ToOffset (Select s projection (From fr fields (Where cd (OrderBy f E))))
ToOffset (Select s projection (From fr fields (Where cd (OrderBy f (Limit n E)))))
ToOffset (Select s projection (From fr fields (Where cd (GroupBy fg (OrderBy f E)))))
ToOffset (Select s projection (From fr fields (Where cd (GroupBy fg (OrderBy f (Limit n E))))))
(RowToList some slist, RowToList more mlist, CompatibleProjection slist mlist) => ToUnion (Select s some (From f fd rt)) (Select t more (From g ge es))
(ToUnion (Select s p (From f fd rt)) (Select t q (From g ge es))) => ToUnion (Union (Select s p (From f fd rt)) sel) (Select t q (From g ge es))
(ToUnion (Select s p (From f fd rt)) (Select t q (From g ge es))) => ToUnion (Select s p (From f fd rt)) (Union (Select t q (From g ge es)) sel)
(SourceAlias f table, SymbolListSingleton table single, ToProjection s fields single pro, RowToList pro list, ToSingleColumn list name t, QueryOptionallyAliased rest name alias, Cons alias t () projection) => ToProjection (Select s p (From f fields rest)) fd aliases projection
(QueryOptionallyAliased rest Empty alias) => SourceAlias (Select s p (From f fd rest)) alias
(QueryMustBeAliased rest alias, RowToList projection list, QualifiedColumns list alias aliased, Union projection aliased fields, SymbolListSingleton alias single) => SourceColumns (Select s projection (From f fd rest)) fields single
Aliased subqueries
(Resume rest b c) => Resume (Select s p rest) b (Select s p c)
#OrderBy Source
data OrderBy f rest
Instances
(LimitedResults rest) => LimitedResults (OrderBy f rest)
(Cons name t e fields, Cons otherName v r fields, UnwrapDefinition v w) => ToArrayAgg (OrderBy (Proxy name) (Proxy otherName)) fields w
(AppendPath alias name fullPath, Cons fullPath t e fields, AppendPath otherAlias otherName otherFullPath, Cons otherFullPath v r fields, UnwrapDefinition v w) => ToArrayAgg (OrderBy (Path alias name) (Path otherAlias otherName)) fields w
(Cons name t e columns, Cons fd g h columns) => ToStringAgg (Proxy name) (OrderBy (Proxy fd) String) columns
(Cons name t e columns) => ToStringAgg (Path table fd) (OrderBy (Proxy name) String) columns
(Cons name t e columns) => ToStringAgg (Proxy name) (OrderBy (Path alias fd) String) columns
ToStringAgg (Path table name) (OrderBy (Path alias fd) String) columns
ToLimit (Select s projection (From fr fields (OrderBy f E)))
ToLimit (Select s projection (From fr fields (OrderBy f (Offset E))))
ToLimit (Select s projection (From fr fields (GroupBy fg (OrderBy f E))))
ToLimit (Select s projection (From fr fields (GroupBy fg (OrderBy f (Offset E)))))
ToLimit (Select s projection (From fr fields (Where cd (OrderBy f E))))
ToLimit (Select s projection (From fr fields (Where cd (OrderBy f (Offset E)))))
ToLimit (Select s projection (From fr fields (Where cd (GroupBy fg (OrderBy f E)))))
ToLimit (Select s projection (From fr fields (Where cd (GroupBy fg (OrderBy f (Offset E))))))
ToOffset (Select s projection (From fr fields (OrderBy f E)))
ToOffset (Select s projection (From fr fields (OrderBy f (Limit n E))))
ToOffset (Select s projection (From fr fields (GroupBy fg (OrderBy f E))))
ToOffset (Select s projection (From fr fields (GroupBy fg (OrderBy f (Limit n E)))))
ToOffset (Select s projection (From fr fields (Where cd (OrderBy f E))))
ToOffset (Select s projection (From fr fields (Where cd (OrderBy f (Limit n E)))))
ToOffset (Select s projection (From fr fields (Where cd (GroupBy fg (OrderBy f E)))))
ToOffset (Select s projection (From fr fields (Where cd (GroupBy fg (OrderBy f (Limit n E))))))
(QueryMustBeAliased rest alias) => QueryMustBeAliased (OrderBy f rest) alias
(QueryOptionallyAliased rest name alias) => QueryOptionallyAliased (OrderBy f rest) name alias
(Resume rest b c) => Resume (OrderBy f rest) b (OrderBy f c)
#On Source
data On c rest
Instances
(ToProjection s fields aliases selected, Nub selected unique, UniqueColumnNames selected unique) => ToFrom (Join k fields l r aliases (On c rest)) (Select s unique E) fields
(ToJoin l left las, ToJoin r right ras, Union left right all, Nub all fields, RowListAppend las ras aliases) => ToJoin (Join Inner fd l r a (On c rest)) fields aliases
JOIN ... ON
(ToJoin l left las, ToJoin r right ras, RowToList right list, ToOuterColumns list out, Union left out all, Nub all fields, RowListAppend las ras aliases) => ToJoin (Join Outer fd l r a (On c rest)) fields aliases
#Offset Source
data Offset rest
Instances
(LimitedResults rest) => LimitedResults (Offset rest)
ToLimit (Select s projection (From fr fields (OrderBy f (Offset E))))
ToLimit (Select s projection (From fr fields (GroupBy fg (OrderBy f (Offset E)))))
ToLimit (Select s projection (From fr fields (Where cd (OrderBy f (Offset E)))))
ToLimit (Select s projection (From fr fields (Where cd (GroupBy fg (OrderBy f (Offset E))))))
(QueryMustBeAliased rest alias) => QueryMustBeAliased (Offset rest) alias
(QueryOptionallyAliased rest name alias) => QueryOptionallyAliased (Offset rest) name alias
(Resume rest b c) => Resume (Offset rest) b (Offset c)
#Limit Source
data Limit :: Int -> Type -> Type
data Limit (n :: Int) rest
Instances
LimitedResults (Limit 1 rest)
ToOffset (Select s projection (From fr fields (OrderBy f (Limit n E))))
ToOffset (Select s projection (From fr fields (GroupBy fg (OrderBy f (Limit n E)))))
ToOffset (Select s projection (From fr fields (Where cd (OrderBy f (Limit n E)))))
ToOffset (Select s projection (From fr fields (Where cd (GroupBy fg (OrderBy f (Limit n E))))))
(QueryMustBeAliased rest alias) => QueryMustBeAliased (Limit n rest) alias
(QueryOptionallyAliased rest name alias) => QueryOptionallyAliased (Limit n rest) name alias
(Resume rest b c) => Resume (Limit n rest) b (Limit n c)
#Join Source
data Join :: Side -> Row Type -> Type -> Type -> RowList Symbol -> Type -> Type
data Join (k :: Side) (fields :: Row Type) q r (aliases :: SymbolList) rest
Instances
(ToProjection s fields aliases selected, Nub selected unique, UniqueColumnNames selected unique) => ToFrom (Join k fields l r aliases (On c rest)) (Select s unique E) fields
(ToJoin l left las, ToJoin r right ras, Union left right all, Nub all fields, RowListAppend las ras aliases) => ToJoin (Join Inner fd l r a (On c rest)) fields aliases
JOIN ... ON
(ToJoin l left las, ToJoin r right ras, RowToList right list, ToOuterColumns list out, Union left out all, Nub all fields, RowListAppend las ras aliases) => ToJoin (Join Outer fd l r a (On c rest)) fields aliases
GroupBySource (Join k columns q r a rest) columns
#Into Source
data Into :: Symbol -> Row Type -> Type -> Type -> Type
data Into (name :: Symbol) (fields :: Row Type) fieldNames rest
Instances
ToPrepare (Insert (Into name fields fieldNames (Values v rest)))
(ReturningColumns f fields) => ToReturning f (Insert (Into tn fields fn (Values fv E)))
(ReturningColumns f fields) => ToReturning f (Insert (Into tn fields DefaultValues E))
(Resume rest b c) => Resume (Into n f fd rest) b (Into n f fd c)
#Insert Source
newtype Insert rest
Instances
ToPrepare (Insert (Into name fields fieldNames (Values v rest)))
(ReturningColumns f fields) => ToReturning f (Insert (Into tn fields fn (Values fv E)))
(ReturningColumns f fields) => ToReturning f (Insert (Into tn fields DefaultValues E))
(Resume rest b c) => Resume (Insert rest) b (Insert c)
#From Source
data From :: Type -> Row Type -> Type -> Type
data From f (fields :: Row Type) rest
Instances
ToPrepare (Select s p (From f fields rest))
ToPrepare (Delete (From f fields rest))
(LimitedResults rest) => LimitedResults (From f fields rest)
(SourceAlias f alias, ToCondition c fields alias) => ToWhere c (Select s projection (From f fields E))
(ToCondition c fields Empty) => ToWhere c (Delete (From f fields E))
(GroupBySource f columns) => ToGroupBy (Select s p (From f fd E)) s columns
(GroupBySource f columns) => ToGroupBy (Select s p (From f fd (Where cond E))) s columns
(QueryMustBeAliased rest alias, RowToList projection list, QualifiedColumns list alias aliased, Union aliased projection all) => GroupBySource (Select s projection (From f fd rest)) all
ToAs (Select s p (From f fields rest)) alias
(SortColumnsSource s projection f columns available, SortColumns st available) => ToOrderBy st (Select s projection (From f columns E))
(GroupedColumns g columns grouped, Union projection grouped pg, Nub pg available, SortColumns st available) => ToOrderBy st (Select s projection (From f columns (GroupBy g E)))
(SortColumnsSource s projection f columns available, SortColumns st available) => ToOrderBy st (Select s projection (From f columns (Where cd E)))
(GroupedColumns g columns grouped, Union projection grouped pg, Nub pg available, SortColumns st available) => ToOrderBy st (Select s projection (From f columns (Where cd (GroupBy g E))))
ToLimit (Select s projection (From fr fields (OrderBy f E)))
ToLimit (Select s projection (From fr fields (OrderBy f (Offset E))))
ToLimit (Select s projection (From fr fields (GroupBy fg (OrderBy f E))))
ToLimit (Select s projection (From fr fields (GroupBy fg (OrderBy f (Offset E)))))
ToLimit (Select s projection (From fr fields (Where cd (OrderBy f E))))
ToLimit (Select s projection (From fr fields (Where cd (OrderBy f (Offset E)))))
ToLimit (Select s projection (From fr fields (Where cd (GroupBy fg (OrderBy f E)))))
ToLimit (Select s projection (From fr fields (Where cd (GroupBy fg (OrderBy f (Offset E))))))
ToOffset (Select s projection (From fr fields (OrderBy f E)))
ToOffset (Select s projection (From fr fields (OrderBy f (Limit n E))))
ToOffset (Select s projection (From fr fields (GroupBy fg (OrderBy f E))))
ToOffset (Select s projection (From fr fields (GroupBy fg (OrderBy f (Limit n E)))))
ToOffset (Select s projection (From fr fields (Where cd (OrderBy f E))))
ToOffset (Select s projection (From fr fields (Where cd (OrderBy f (Limit n E)))))
ToOffset (Select s projection (From fr fields (Where cd (GroupBy fg (OrderBy f E)))))
ToOffset (Select s projection (From fr fields (Where cd (GroupBy fg (OrderBy f (Limit n E))))))
(RowToList some slist, RowToList more mlist, CompatibleProjection slist mlist) => ToUnion (Select s some (From f fd rt)) (Select t more (From g ge es))
(ToUnion (Select s p (From f fd rt)) (Select t q (From g ge es))) => ToUnion (Union (Select s p (From f fd rt)) sel) (Select t q (From g ge es))
(ToUnion (Select s p (From f fd rt)) (Select t q (From g ge es))) => ToUnion (Select s p (From f fd rt)) (Union (Select t q (From g ge es)) sel)
(SourceAlias f table, SymbolListSingleton table single, ToProjection s fields single pro, RowToList pro list, ToSingleColumn list name t, QueryOptionallyAliased rest name alias, Cons alias t () projection) => ToProjection (Select s p (From f fields rest)) fd aliases projection
(QueryOptionallyAliased rest Empty alias) => SourceAlias (Select s p (From f fd rest)) alias
(QueryMustBeAliased rest alias, RowToList projection list, QualifiedColumns list alias aliased, Union projection aliased fields, SymbolListSingleton alias single) => SourceColumns (Select s projection (From f fd rest)) fields single
Aliased subqueries
(Resume rest b c) => Resume (From f fd rest) b (From f fd c)
#Distinct Source
newtype Distinct s
Instances
ToSelect (Distinct s)
(ValidGroupByProjection s grouped) => ValidGroupByProjection (Distinct s) grouped
SortColumnsSource (Distinct s) projection f columns projection
(ToProjection s fields aliases projection) => ToProjection (Distinct s) fields aliases projection
#DefaultValues Source
data DefaultValues
Instances
InsertList fields DefaultValues ()
(ReturningColumns f fields) => ToReturning f (Insert (Into tn fields DefaultValues E))
#As Source
newtype As :: Symbol -> Type -> Type
newtype As (alias :: Symbol) rest
Instances
ToSelect (As alias Int)
ToSelect (As alias (Proxy name))
ToSelect (As alias (Path table name))
ToSelect (As alias (Aggregate inp rest fields out))
ToSelect (As alias (PgFunction inp arg fields out))
ToSubExpression (As alias Int)
ToSubExpression (As alias (Proxy name))
ToSubExpression (As alias (Path table name))
ToSubExpression (As alias (PgFunction inp arg fields out))
ToSubExpression (As alias (Aggregate inp r fields out))
(RowToList columns list, QualifiedColumns list alias aliased, Union aliased columns all) => GroupBySource (As alias (Table name columns)) all
(Cons name t e grouped) => ValidGroupByProjection (As alias (Proxy name)) grouped
(Cons name t e grouped) => ValidGroupByProjection (As alias (Aggregate (Proxy name) rest fields out)) grouped
OnlyAggregations (As n (Aggregate i rest f o)) True
(Cons alias Int () projection) => ToProjection (As alias Int) fields aliases projection
(Cons alias t () projection) => ToProjection (As alias (Aggregate inp rest fields t)) fields aliases projection
(Cons alias t () projection) => ToProjection (As alias (PgFunction inp args fields t)) fields aliases projection
(Cons name t e fields, JoinedToMaybe t v, UnwrapDefinition v u, Cons alias u () projection) => ToProjection (As alias (Proxy name)) fields aliases projection
(SymbolListSingleton table single, RowListAppend single aliases all, RowListNub all unique, OuterScopeAlias all unique y, AppendPath table name fullPath, QualifiedColumn y fullPath fields t, Cons alias t () projection) => ToProjection (As alias (Path table name)) fields aliases projection
SourceAlias (As alias (Table name fields)) alias
QueryMustBeAliased (As alias E) alias
QueryOptionallyAliased (As alias E) name alias
(RowToList source list, QualifiedColumns list alias aliased, Union aliased source fields, SymbolListSingleton alias single) => SourceColumns (As alias (Table name source)) fields single
Aliased tables
Resume (As alias E) b (As alias b)
#values Source
values :: forall tableName fields names fieldValues. ConsistentArity fieldValues => InsertValues fields names fieldValues => fieldValues -> Insert (Into tableName fields names E) -> Insert (Into tableName fields names (Values fieldValues E))
#select Source
select :: forall s projection. ToSelect s => s -> Select s projection E
SELECT can project literals, columns and subqueries with the following considerations:
- Multiple columns are represented by tuples.
Data.Tuple.Nested./\
is convenient for this - Literal values (e.g., numbers) must be aliased (with AS)
- Columns names in projections must be unique, or referenced by different table aliases (e.g., u.name, t.name)
- Subqueries must return a single column
#returning Source
returning :: forall f q sql. ToReturning f q => Resume q (Returning f) sql => f -> q -> sql
#prepare Source
prepare :: forall q. ToPrepare q => Plan -> q -> Prepare q
https://www.postgresql.org/docs/current/sql-prepare.html
PREPARE statements can be employed to reuse execution plans, and thus optimize performance
Note: droplet always creates server-side parameters for literal values in queries. In the case of PREPARE, however, literals will be parsed as statement parameters
#leftJoin Source
leftJoin :: forall r l las ras list out aliases unique rf lf right left all fields source. ToJoin l left las => ToJoin r right ras => UniqueSources left right => RowListAppend las ras aliases => RowListNub aliases unique => UniqueAliases aliases unique => Union left right all => Nub all source => Union left lf source => Union right rf source => RowToList lf list => ToOuterColumns list out => Union rf out fields => l -> r -> Join Outer fields l r aliases E
LEFT OUTER JOIN statement
JOIN sources are the same as FROM
#join Source
join :: forall r l aliases unique las ras right rf lf left all source fields. ToJoin l left las => ToJoin r right ras => UniqueSources left right => RowListAppend las ras aliases => RowListNub aliases unique => UniqueAliases aliases unique => Union right left all => Nub all source => Union left lf source => Union right rf source => Union lf rf fields => l -> r -> Join Inner fields l r aliases E
INNER JOIN statement
JOIN sources are the same as FROM
#into Source
into :: forall tableName fields fieldNames fieldList required inserted. RowToList fields fieldList => RequiredColumns fieldList required => InsertList fields fieldNames inserted => MissingRequiredColumns required inserted => Table tableName fields -> fieldNames -> Insert E -> Insert (Into tableName fields fieldNames E)
#groupBy Source
groupBy :: forall f s q sql grouped columns. ToGroupBy q s columns => GroupedColumns f columns grouped => ValidGroupByProjection s grouped => Resume q (GroupBy f E) sql => f -> q -> sql
GROUP BY statement
#from Source
from :: forall f q fields sql. ToFrom f q fields => Resume q (From f fields E) sql => f -> q -> sql
FROM accepts the following sources
- Tables
- Inner and outer joins
- Aliased tables
- Aliased SELECT statements
Due to how SQL binding works, joins and subqueries require brackets to be parsed correctly. For example:
SELECT column FROM (SELECT column FROM table) AS alias
should beselect column # from (select column # from table # as alias)
)SELECT column FROM table alias JOIN other_table other_alias
should beselect column # from ((table # as alias)
join(other_table # as other_alias))
)
To aid composition, SELECT projections are only validated on FROM
- Modules
- Droplet.
Driver - Droplet.
Driver. Internal. Migration - Droplet.
Driver. Internal. Pool - Droplet.
Driver. Internal. Query - Droplet.
Driver. Migration - Droplet.
Driver. Unsafe - Droplet.
Language - Droplet.
Language. Internal. Condition - Droplet.
Language. Internal. Definition - Droplet.
Language. Internal. Function - Droplet.
Language. Internal. Syntax - Droplet.
Language. Internal. Token - Droplet.
Language. Internal. Translate
AND/OR