orville-postgresql-1.0.0.0: A Haskell library for PostgreSQL
CopyrightFlipstone Technology Partners 2023
LicenseMIT
StabilityStable
Safe HaskellSafe-Inferred
LanguageHaskell2010

Orville.PostgreSQL.Expr.Query

Description

Since: 1.0.0.0

Synopsis

Documentation

data QueryExpr Source #

Type to represent a SQL query, E.G.

SELECT id FROM some_table

QueryExpr provides a SqlExpression instance. See unsafeSqlExpression for how to construct a value with your own custom SQL.

Since: 1.0.0.0

Instances

Instances details
SqlExpression QueryExpr Source # 
Instance details

Defined in Orville.PostgreSQL.Expr.Query

queryExpr :: SelectClause -> SelectList -> Maybe TableExpr -> QueryExpr Source #

Builds a QueryExpr from the given SelectClause, SelectList and TableExpr. The resulting QueryExpr is suitable for execution via the SQL execution functions in Orville.PostgreSQL.Execution and Orville.PostgreSQL.Raw.RawSql.

Since: 1.0.0.0

data SelectList Source #

Type to represent the list of items to be selected in a SELECT clause. E.G. the

foo, bar, baz

in

SELECT foo, bar, baz FROM some_table

SelectList provides a SqlExpression instance. See unsafeSqlExpression for how to construct a value with your own custom SQL.

Since: 1.0.0.0

Instances

Instances details
SqlExpression SelectList Source # 
Instance details

Defined in Orville.PostgreSQL.Expr.Query

selectColumns :: [ColumnName] -> SelectList Source #

Constructs a SelectList that will select the specified column names. This is a special case of selectDerivedColumns where all the items to be selected are simple column references.

Since: 1.0.0.0

data DerivedColumn Source #

Type to represent an individual item in a list of selected items. E.G.

now() as current_time

DerivedColumn provides a SqlExpression instance. See unsafeSqlExpression for how to construct a value with your own custom SQL.

Since: 1.0.0.0

deriveColumn :: ValueExpression -> DerivedColumn Source #

Constructs a DerivedColumn that will select the given value. No name will be given to the value in the result set. See deriveColumnAs to give the value a name in the result set.

Since: 1.0.0.0

deriveColumnAs :: ValueExpression -> ColumnName -> DerivedColumn Source #

Constructs a DerivedColumn that will select the given value and give it the specified column name in the result set.

Since: 1.0.0.0

selectDerivedColumns :: [DerivedColumn] -> SelectList Source #

Constructs a SelectList that will select the specified items, which may be column references or other expressions as allowed by DerivedColumn. See also selectColumns the simpler case of selecting a list of column names.

Since: 1.0.0.0

selectStar :: SelectList Source #

Constructs a SelectList that will select all colums (i.e. the * in SELECT *").

Since: 1.0.0.0

data TableExpr Source #

Type to represent a table expression (including its associated options) in a SELECT. This is the part that would appear *after* the word FROM. E.G.

foo
WHERE id > 100
ORDER BY id
LIMIT 1
OFFSET 2

TableExpr provides a SqlExpression instance. See unsafeSqlExpression for how to construct a value with your own custom SQL.

Since: 1.0.0.0

Instances

Instances details
SqlExpression TableExpr Source # 
Instance details

Defined in Orville.PostgreSQL.Expr.Query

tableExpr Source #

Arguments

:: TableReferenceList

The list of tables to query from.

-> Maybe WhereClause

An optional WHERE clause to limit the results returned.

-> Maybe GroupByClause

An optional GROUP BY clause to group the result set rows.

-> Maybe OrderByClause

An optional ORDER BY clause to order the result set rows.

-> Maybe LimitExpr

An optional LIMIT to apply to the result set.

-> Maybe OffsetExpr

An optional OFFSET to apply to the result set.

-> TableExpr 

Constructs a TableExpr with the given options.

Since: 1.0.0.0