Safe Haskell | None |
---|---|
Language | Haskell2010 |
Database.Beam.Backend.SQL
Synopsis
- module Database.Beam.Backend.SQL.Row
- module Database.Beam.Backend.SQL.SQL2003
- module Database.Beam.Backend.SQL.Types
-
class
(
BeamBackend
be,
Monad
m) =>
MonadBeam
be m | m -> be
where
- runReturningMany :: FromBackendRow be x => BeamSqlBackendSyntax be -> (m ( Maybe x) -> m a) -> m a
- runNoReturn :: BeamSqlBackendSyntax be -> m ()
- runReturningOne :: FromBackendRow be x => BeamSqlBackendSyntax be -> m ( Maybe x)
- runReturningList :: FromBackendRow be x => BeamSqlBackendSyntax be -> m [x]
- class ( BeamBackend be, IsSql92Syntax ( BeamSqlBackendSyntax be), Sql92SanityCheck ( BeamSqlBackendSyntax be), HasSqlValueSyntax ( BeamSqlBackendValueSyntax be) Bool , HasSqlValueSyntax ( BeamSqlBackendValueSyntax be) SqlNull , Eq ( BeamSqlBackendExpressionSyntax be)) => BeamSqlBackend be
- type family BeamSqlBackendSyntax be :: Type
- data MockSqlBackend syntax
- class BeamSqlBackendIsString be text
- type BeamSql99ExpressionBackend be = IsSql99ExpressionSyntax ( BeamSqlBackendExpressionSyntax be)
- type BeamSql99AggregationBackend be = IsSql99AggregationExpressionSyntax ( BeamSqlBackendExpressionSyntax be)
- type BeamSql99ConcatExpressionBackend be = IsSql99ConcatExpressionSyntax ( BeamSqlBackendExpressionSyntax be)
- type BeamSql99CommonTableExpressionBackend be = ( BeamSqlBackend be, IsSql99CommonTableExpressionSelectSyntax ( BeamSqlBackendSelectSyntax be), IsSql99CommonTableExpressionSyntax ( BeamSql99BackendCTESyntax be), Sql99CTESelectSyntax ( BeamSql99BackendCTESyntax be) ~ BeamSqlBackendSelectSyntax be)
- type BeamSql99RecursiveCTEBackend be = ( BeamSql99CommonTableExpressionBackend be, IsSql99RecursiveCommonTableExpressionSelectSyntax ( BeamSqlBackendSelectSyntax be))
- type BeamSql2003ExpressionBackend be = ( IsSql2003ExpressionSyntax ( BeamSqlBackendExpressionSyntax be), Sql2003SanityCheck ( BeamSqlBackendSyntax be))
- type BeamSqlT021Backend be = IsSql2003BinaryAndVarBinaryDataTypeSyntax ( BeamSqlBackendCastTargetSyntax be)
- type BeamSqlT071Backend be = IsSql2008BigIntDataTypeSyntax ( BeamSqlBackendCastTargetSyntax be)
- type BeamSqlT611Backend be = IsSql2003ExpressionElementaryOLAPOperationsSyntax ( BeamSqlBackendExpressionSyntax be)
- type BeamSqlT612Backend be = IsSql2003ExpressionAdvancedOLAPOperationsSyntax ( BeamSqlBackendExpressionSyntax be)
- type BeamSqlT614Backend be = IsSql2003NtileExpressionSyntax ( BeamSqlBackendExpressionSyntax be)
- type BeamSqlT615Backend be = IsSql2003LeadAndLagExpressionSyntax ( BeamSqlBackendExpressionSyntax be)
- type BeamSqlT616Backend be = IsSql2003FirstValueAndLastValueExpressionSyntax ( BeamSqlBackendExpressionSyntax be)
- type BeamSqlT618Backend be = IsSql2003NthValueExpressionSyntax ( BeamSqlBackendExpressionSyntax be)
- type BeamSqlT621Backend be = ( IsSql2003EnhancedNumericFunctionsExpressionSyntax ( BeamSqlBackendExpressionSyntax be), IsSql2003EnhancedNumericFunctionsAggregationExpressionSyntax ( BeamSqlBackendExpressionSyntax be))
- type BeamSql99DataTypeBackend be = ( BeamSqlBackend be, IsSql99DataTypeSyntax ( BeamSqlBackendCastTargetSyntax be))
- type BeamSqlBackendSupportsOuterJoin be = IsSql92FromOuterJoinSyntax ( BeamSqlBackendFromSyntax be)
- type BeamSqlBackendSelectSyntax be = Sql92SelectSyntax ( BeamSqlBackendSyntax be)
- type BeamSqlBackendInsertSyntax be = Sql92InsertSyntax ( BeamSqlBackendSyntax be)
- type BeamSqlBackendInsertValuesSyntax be = Sql92InsertValuesSyntax ( BeamSqlBackendInsertSyntax be)
- type BeamSqlBackendUpdateSyntax be = Sql92UpdateSyntax ( BeamSqlBackendSyntax be)
- type BeamSqlBackendDeleteSyntax be = Sql92DeleteSyntax ( BeamSqlBackendSyntax be)
- type BeamSqlBackendCastTargetSyntax be = Sql92ExpressionCastTargetSyntax ( BeamSqlBackendExpressionSyntax be)
- type BeamSqlBackendSelectTableSyntax be = Sql92SelectSelectTableSyntax ( BeamSqlBackendSelectSyntax be)
- type BeamSqlBackendAggregationQuantifierSyntax be = Sql92AggregationSetQuantifierSyntax ( BeamSqlBackendExpressionSyntax be)
- type BeamSqlBackendSetQuantifierSyntax be = Sql92SelectTableSetQuantifierSyntax ( BeamSqlBackendSelectTableSyntax be)
- type BeamSqlBackendFromSyntax be = Sql92SelectFromSyntax ( BeamSqlBackendSelectSyntax be)
- type BeamSqlBackendTableNameSyntax be = Sql92TableSourceTableNameSyntax ( Sql92FromTableSourceSyntax ( BeamSqlBackendFromSyntax be))
- type BeamSqlBackendExpressionSyntax be = Sql92ExpressionSyntax ( BeamSqlBackendSyntax be)
- type BeamSqlBackendDataTypeSyntax be = Sql92ExpressionCastTargetSyntax ( BeamSqlBackendExpressionSyntax be)
- type BeamSqlBackendFieldNameSyntax be = Sql92ExpressionFieldNameSyntax ( BeamSqlBackendExpressionSyntax be)
- type BeamSqlBackendExpressionQuantifierSyntax be = Sql92ExpressionQuantifierSyntax ( Sql92ExpressionSyntax ( BeamSqlBackendSyntax be))
- type BeamSqlBackendValueSyntax be = Sql92ValueSyntax ( BeamSqlBackendSyntax be)
- type BeamSqlBackendOrderingSyntax be = Sql92SelectOrderingSyntax ( BeamSqlBackendSelectSyntax be)
- type BeamSqlBackendGroupingSyntax be = Sql92SelectTableGroupingSyntax ( BeamSqlBackendSelectTableSyntax be)
- type BeamSqlBackendWindowFrameSyntax be = Sql2003ExpressionWindowFrameSyntax ( BeamSqlBackendExpressionSyntax be)
- type BeamSqlBackendWindowFrameBoundsSyntax be = Sql2003WindowFrameBoundsSyntax ( BeamSqlBackendWindowFrameSyntax be)
- type BeamSqlBackendWindowFrameBoundSyntax be = Sql2003WindowFrameBoundsBoundSyntax ( BeamSqlBackendWindowFrameBoundsSyntax be)
- type BeamSql99BackendCTESyntax be = Sql99SelectCTESyntax ( BeamSqlBackendSelectSyntax be)
- type BeamSqlBackendCanSerialize be = HasSqlValueSyntax ( BeamSqlBackendValueSyntax be)
- type BeamSqlBackendCanDeserialize be = FromBackendRow be
- type BeamSqlBackendSupportsDataType be x = ( BeamSqlBackendCanDeserialize be x, BeamSqlBackendCanSerialize be x)
Documentation
class ( BeamBackend be, Monad m) => MonadBeam be m | m -> be where Source #
A class that ties together a monad with a particular backend
Provided here is a low-level interface for executing commands. The 'run*'
functions are wrapped by the appropriate functions in
Query
.
This interface is very high-level and isn't meant to expose the full power
of the underlying database. Namely, it only supports simple data retrieval
strategies. More complicated strategies (for example, Postgres's
COPY
)
are supported in individual backends. See the documentation of those
backends for more details.
Minimal complete definition
Methods
Arguments
:: FromBackendRow be x | |
=> BeamSqlBackendSyntax be |
The query to run |
-> (m ( Maybe x) -> m a) |
Reader action that will be called with a function to fetch the next row |
-> m a |
Run a query determined by the given syntax, providing an action that will
be called to consume the results from the database (if any). The action
will get a reader action that can be used to fetch the next row. When
this reader action returns
Nothing
, there are no rows left to consume.
When the reader action returns, the database result is freed.
runNoReturn :: BeamSqlBackendSyntax be -> m () Source #
Run the given command and don't consume any results. Useful for DML statements like INSERT, UPDATE, and DELETE, or DDL statements.
runReturningOne :: FromBackendRow be x => BeamSqlBackendSyntax be -> m ( Maybe x) Source #
Run the given command and fetch the unique result. The result is
Nothing
if either no results are returned or more than one result is
returned.
runReturningList :: FromBackendRow be x => BeamSqlBackendSyntax be -> m [x] Source #
Run the given command, collect all the results, and return them as a
list. May be more convenient than
runReturningMany
, but reads the entire
result set into memory.
Instances
class ( BeamBackend be, IsSql92Syntax ( BeamSqlBackendSyntax be), Sql92SanityCheck ( BeamSqlBackendSyntax be), HasSqlValueSyntax ( BeamSqlBackendValueSyntax be) Bool , HasSqlValueSyntax ( BeamSqlBackendValueSyntax be) SqlNull , Eq ( BeamSqlBackendExpressionSyntax be)) => BeamSqlBackend be Source #
Class for all Beam SQL backends
Instances
( IsSql92Syntax syntax, Sql92SanityCheck syntax, HasSqlValueSyntax ( Sql92ValueSyntax syntax) Bool , HasSqlValueSyntax ( Sql92ValueSyntax syntax) SqlNull , Eq ( Sql92ExpressionSyntax syntax)) => BeamSqlBackend ( MockSqlBackend syntax) Source # | |
Defined in Database.Beam.Backend.SQL |
type family BeamSqlBackendSyntax be :: Type Source #
Instances
type BeamSqlBackendSyntax ( MockSqlBackend syntax) Source # | |
Defined in Database.Beam.Backend.SQL |
data MockSqlBackend syntax Source #
Fake backend that cannot deserialize anything, but is useful for testing
Instances
class BeamSqlBackendIsString be text Source #
Type class for things which are text-like in this backend
Instances
BeamSqlBackendIsString be t => BeamSqlBackendIsString (be :: k1) ( Tagged tag t :: Type ) Source # | |
Defined in Database.Beam.Backend.SQL |
|
BeamSqlBackendIsString ( MockSqlBackend cmd :: Type ) Text Source # | |
Defined in Database.Beam.Backend.SQL |
|
BeamSqlBackendIsString ( MockSqlBackend cmd :: Type ) [ Char ] Source # | |
Defined in Database.Beam.Backend.SQL |
type BeamSql99ExpressionBackend be = IsSql99ExpressionSyntax ( BeamSqlBackendExpressionSyntax be) Source #
type BeamSql99AggregationBackend be = IsSql99AggregationExpressionSyntax ( BeamSqlBackendExpressionSyntax be) Source #
type BeamSql99ConcatExpressionBackend be = IsSql99ConcatExpressionSyntax ( BeamSqlBackendExpressionSyntax be) Source #
type BeamSql99CommonTableExpressionBackend be = ( BeamSqlBackend be, IsSql99CommonTableExpressionSelectSyntax ( BeamSqlBackendSelectSyntax be), IsSql99CommonTableExpressionSyntax ( BeamSql99BackendCTESyntax be), Sql99CTESelectSyntax ( BeamSql99BackendCTESyntax be) ~ BeamSqlBackendSelectSyntax be) Source #
type BeamSql99RecursiveCTEBackend be = ( BeamSql99CommonTableExpressionBackend be, IsSql99RecursiveCommonTableExpressionSelectSyntax ( BeamSqlBackendSelectSyntax be)) Source #
type BeamSql2003ExpressionBackend be = ( IsSql2003ExpressionSyntax ( BeamSqlBackendExpressionSyntax be), Sql2003SanityCheck ( BeamSqlBackendSyntax be)) Source #
type BeamSqlT021Backend be = IsSql2003BinaryAndVarBinaryDataTypeSyntax ( BeamSqlBackendCastTargetSyntax be) Source #
type BeamSqlT071Backend be = IsSql2008BigIntDataTypeSyntax ( BeamSqlBackendCastTargetSyntax be) Source #
type BeamSqlT611Backend be = IsSql2003ExpressionElementaryOLAPOperationsSyntax ( BeamSqlBackendExpressionSyntax be) Source #
type BeamSqlT612Backend be = IsSql2003ExpressionAdvancedOLAPOperationsSyntax ( BeamSqlBackendExpressionSyntax be) Source #
type BeamSqlT614Backend be = IsSql2003NtileExpressionSyntax ( BeamSqlBackendExpressionSyntax be) Source #
type BeamSqlT615Backend be = IsSql2003LeadAndLagExpressionSyntax ( BeamSqlBackendExpressionSyntax be) Source #
type BeamSqlT616Backend be = IsSql2003FirstValueAndLastValueExpressionSyntax ( BeamSqlBackendExpressionSyntax be) Source #
type BeamSqlT618Backend be = IsSql2003NthValueExpressionSyntax ( BeamSqlBackendExpressionSyntax be) Source #
type BeamSqlT621Backend be = ( IsSql2003EnhancedNumericFunctionsExpressionSyntax ( BeamSqlBackendExpressionSyntax be), IsSql2003EnhancedNumericFunctionsAggregationExpressionSyntax ( BeamSqlBackendExpressionSyntax be)) Source #
type BeamSql99DataTypeBackend be = ( BeamSqlBackend be, IsSql99DataTypeSyntax ( BeamSqlBackendCastTargetSyntax be)) Source #
type BeamSqlBackendSupportsOuterJoin be = IsSql92FromOuterJoinSyntax ( BeamSqlBackendFromSyntax be) Source #
type BeamSqlBackendSelectSyntax be = Sql92SelectSyntax ( BeamSqlBackendSyntax be) Source #
type BeamSqlBackendInsertSyntax be = Sql92InsertSyntax ( BeamSqlBackendSyntax be) Source #
type BeamSqlBackendInsertValuesSyntax be = Sql92InsertValuesSyntax ( BeamSqlBackendInsertSyntax be) Source #
type BeamSqlBackendUpdateSyntax be = Sql92UpdateSyntax ( BeamSqlBackendSyntax be) Source #
type BeamSqlBackendDeleteSyntax be = Sql92DeleteSyntax ( BeamSqlBackendSyntax be) Source #
type BeamSqlBackendCastTargetSyntax be = Sql92ExpressionCastTargetSyntax ( BeamSqlBackendExpressionSyntax be) Source #
type BeamSqlBackendSelectTableSyntax be = Sql92SelectSelectTableSyntax ( BeamSqlBackendSelectSyntax be) Source #
type BeamSqlBackendAggregationQuantifierSyntax be = Sql92AggregationSetQuantifierSyntax ( BeamSqlBackendExpressionSyntax be) Source #
type BeamSqlBackendSetQuantifierSyntax be = Sql92SelectTableSetQuantifierSyntax ( BeamSqlBackendSelectTableSyntax be) Source #
type BeamSqlBackendFromSyntax be = Sql92SelectFromSyntax ( BeamSqlBackendSelectSyntax be) Source #
type BeamSqlBackendTableNameSyntax be = Sql92TableSourceTableNameSyntax ( Sql92FromTableSourceSyntax ( BeamSqlBackendFromSyntax be)) Source #
type BeamSqlBackendExpressionSyntax be = Sql92ExpressionSyntax ( BeamSqlBackendSyntax be) Source #
type BeamSqlBackendDataTypeSyntax be = Sql92ExpressionCastTargetSyntax ( BeamSqlBackendExpressionSyntax be) Source #
type BeamSqlBackendFieldNameSyntax be = Sql92ExpressionFieldNameSyntax ( BeamSqlBackendExpressionSyntax be) Source #
type BeamSqlBackendExpressionQuantifierSyntax be = Sql92ExpressionQuantifierSyntax ( Sql92ExpressionSyntax ( BeamSqlBackendSyntax be)) Source #
type BeamSqlBackendValueSyntax be = Sql92ValueSyntax ( BeamSqlBackendSyntax be) Source #
type BeamSqlBackendOrderingSyntax be = Sql92SelectOrderingSyntax ( BeamSqlBackendSelectSyntax be) Source #
type BeamSqlBackendGroupingSyntax be = Sql92SelectTableGroupingSyntax ( BeamSqlBackendSelectTableSyntax be) Source #
type BeamSqlBackendWindowFrameSyntax be = Sql2003ExpressionWindowFrameSyntax ( BeamSqlBackendExpressionSyntax be) Source #
type BeamSqlBackendWindowFrameBoundsSyntax be = Sql2003WindowFrameBoundsSyntax ( BeamSqlBackendWindowFrameSyntax be) Source #
type BeamSqlBackendWindowFrameBoundSyntax be = Sql2003WindowFrameBoundsBoundSyntax ( BeamSqlBackendWindowFrameBoundsSyntax be) Source #
type BeamSql99BackendCTESyntax be = Sql99SelectCTESyntax ( BeamSqlBackendSelectSyntax be) Source #
type BeamSqlBackendCanSerialize be = HasSqlValueSyntax ( BeamSqlBackendValueSyntax be) Source #
type BeamSqlBackendCanDeserialize be = FromBackendRow be Source #
type BeamSqlBackendSupportsDataType be x = ( BeamSqlBackendCanDeserialize be x, BeamSqlBackendCanSerialize be x) Source #