Module

Droplet.Language.Internal.Query

Package
purescript-droplet
Repository
easafe/purescript-droplet

ToQuery, a type class to generate parameterized SQL statement strings

Do not import this module directly, it will break your code and make it not type safe. Use the sanitized Droplet.Driver instead

#FilteredQuery Source

class FilteredQuery :: Type -> Row Type -> Constraintclass FilteredQuery (q :: Type) (outer :: Row Type) 

would be nice to dry this like tocondition, but gotta find a way to only check Paths Checks for invalid qualified columns usage in conditional clauses

Instances

#QualifiedProjection Source

class QualifiedProjection :: Type -> Row Type -> Row Type -> Constraintclass QualifiedProjection (s :: Type) (outer :: Row Type) (projection :: Row Type) | s -> outer projection

Validates qualified columns that ToProjection didn't have the context for

Instances

#TranslateSource Source

class TranslateSource (q :: Type)  where

Print field source

Members

Instances

#ToNakedProjection Source

class ToNakedProjection :: Type -> Row Type -> Constraintclass ToNakedProjection (s :: Type) (projection :: Row Type) 

Naked selects may be composed of subqueries whose projections need to be checked and merged individually

Instances

#SingleQualifiedColumn Source

class SingleQualifiedColumn :: RowList Type -> Type -> Row Type -> Constraintclass SingleQualifiedColumn (fields :: RowList Type) (q :: Type) (single :: Row Type) | fields -> q single

Projects a single qualified column, if it exists

Instances

#TranslateColumn Source

class TranslateColumn q  where

Print selected columns

Members

Instances

#NoAggregations Source

class NoAggregations :: Type -> Boolean -> Constraintclass NoAggregations (q :: Type) (is :: Boolean) | q -> is

Are all columns not aggregated?

Instances

#OnlyAggregations Source

class OnlyAggregations :: Type -> Boolean -> Constraintclass OnlyAggregations (q :: Type) (is :: Boolean) | q -> is

Are all columns aggregated?

Instances

#AggregatedQuery Source

class AggregatedQuery (s :: Type) (q :: Type) 

Asserts that queries not using GROUP BY do not mix aggregated and non aggregated columns

Instances

#IsValidAggregation Source

class IsValidAggregation :: Boolean -> Boolean -> Constraintclass IsValidAggregation (s :: Boolean) (t :: Boolean) 

Check aggregation results

Having a separated type class leads to better error messages

Instances

#ToJoinType Source

class ToJoinType :: Side -> Constraintclass ToJoinType (k :: Side)  where

Print join type

Members

Instances

#ArgumentList Source

class ArgumentList v  where

Name list for functions, or when fields and parameters can be mixed

Members

Instances

#QueryMustNotBeAliased Source

class QueryMustNotBeAliased (q :: Type) 

Prevents top level queries to end in AS

Instances

#ToQuery Source

class ToQuery :: Type -> Row Type -> Constraintclass ToQuery (q :: Type) (projection :: Row Type) | q -> projection where

Builds a SQL query

Members

Instances

#TranslateNakedColumn Source

class TranslateNakedColumn q  where

Print naked selects

Members

Instances

#NameList Source

class NameList fieldNames  where

Names (possibly) separated by comma

Used by INSERT, ORDER BY

Members

Instances

#NameValuePairs Source

class NameValuePairs pairs  where

UPDATE list

Members

Instances

#ValueList Source

class ValueList fieldValues  where

Members

Instances

#Translate Source

class Translate q  where

Print SQL statements

Members

Instances

#Query Source

data Query :: Row Type -> Typedata Query (projection :: Row Type)

Constructors

Instances

#QueryState Source

type QueryState = { bracketed :: Boolean, parameters :: Array Foreign, plan :: Maybe Plan }

#buildQuery Source

buildQuery :: forall q projection. ToQuery q projection => q -> Query projection

#unsafeBuildQuery Source

unsafeBuildQuery :: forall projection parameters pra. RowToList parameters pra => ToParameters parameters pra => Maybe Plan -> String -> Record parameters -> Query projection