postgrest-0.4.2.0: REST API for any Postgres database

Safe Haskell | None
Language | Haskell2010

PostgREST.QueryBuilder

Description

This module provides functions to consume data types that represent database objects (e.g. Relation, Schema, SqlQuery) and produces SQL Statements.

Any function that outputs a SQL fragment should be in this module.

Synopsis

- callProc :: QualifiedIdentifier -> Object -> SqlQuery -> SqlQuery -> NonnegRange -> Bool -> Bool -> Bool -> Bool -> Query () (Maybe ProcResults)
- createReadStatement :: SqlQuery -> SqlQuery -> Bool -> Bool -> Bool -> Maybe FieldName -> Query () ResultsWithCount
- createWriteStatement :: SqlQuery -> SqlQuery -> Bool -> Bool -> Bool -> PreferRepresentation -> [Text] -> Query PayloadJSON (Maybe ResultsWithCount)
- getJoinConditions :: Relation -> [Filter]
- pgFmtIdent :: SqlFragment -> SqlFragment
- pgFmtLit :: SqlFragment -> SqlFragment
- requestToQuery :: Schema -> Bool -> DbRequest -> SqlQuery
- requestToCountQuery :: Schema -> DbRequest -> SqlQuery
- sourceCTEName :: SqlFragment
- unquoted :: Value -> Text
- type ResultsWithCount = (Maybe Int64, Int64, [ByteString], ByteString)
- pgFmtEnvVar :: Text -> (Text, Text) -> SqlFragment

# Documentation

callProc :: QualifiedIdentifier -> Object -> SqlQuery -> SqlQuery -> NonnegRange -> Bool -> Bool -> Bool -> Bool -> Query () (Maybe ProcResults) #

createReadStatement :: SqlQuery -> SqlQuery -> Bool -> Bool -> Bool -> Maybe FieldName -> Query () ResultsWithCount #

createWriteStatement :: SqlQuery -> SqlQuery -> Bool -> Bool -> Bool -> PreferRepresentation -> [Text] -> Query PayloadJSON (Maybe ResultsWithCount) #

getJoinConditions :: Relation -> [Filter] #

pgFmtIdent :: SqlFragment -> SqlFragment #

pgFmtLit :: SqlFragment -> SqlFragment #

requestToQuery :: Schema -> Bool -> DbRequest -> SqlQuery #

requestToCountQuery :: Schema -> DbRequest -> SqlQuery #

sourceCTEName :: SqlFragment #

unquoted :: Value -> Text #

type ResultsWithCount = (Maybe Int64, Int64, [ByteString], ByteString) #

The generic query result format used by API responses. The location header is represented as a list of strings containing variable bindings like `"k1=eq.42"`, or the empty list if there is no location header.

pgFmtEnvVar :: Text -> (Text, Text) -> SqlFragment #