Copyright | Flipstone Technology Partners 2023 |
---|---|
License | MIT |
Stability | Stable |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Since: 1.0.0.0
Synopsis
- data QueryExpr
- queryExpr :: SelectClause -> SelectList -> Maybe TableExpr -> QueryExpr
- data SelectList
- selectColumns :: [ColumnName] -> SelectList
- data DerivedColumn
- deriveColumn :: ValueExpression -> DerivedColumn
- deriveColumnAs :: ValueExpression -> ColumnName -> DerivedColumn
- selectDerivedColumns :: [DerivedColumn] -> SelectList
- selectStar :: SelectList
- data TableExpr
- tableExpr :: TableReferenceList -> Maybe WhereClause -> Maybe GroupByClause -> Maybe OrderByClause -> Maybe LimitExpr -> Maybe OffsetExpr -> TableExpr
Documentation
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
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
SqlExpression SelectList Source # | |
Defined in Orville.PostgreSQL.Expr.Query toRawSql :: SelectList -> RawSql Source # unsafeFromRawSql :: RawSql -> SelectList Source # |
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
Instances
SqlExpression DerivedColumn Source # | |
Defined in Orville.PostgreSQL.Expr.Query toRawSql :: DerivedColumn -> RawSql Source # |
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
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
:: TableReferenceList | The list of tables to query from. |
-> Maybe WhereClause | An optional |
-> Maybe GroupByClause | An optional |
-> Maybe OrderByClause | An optional |
-> Maybe LimitExpr | An optional |
-> Maybe OffsetExpr | An optional |
-> TableExpr |
Constructs a TableExpr
with the given options.
Since: 1.0.0.0