Safe Haskell | None |
---|---|
Language | Haskell2010 |
Top-level Beam module. This module re-exports all the symbols necessary for most common user operations.
The most interesting modules are Schema
and Query
.
This is mainly reference documentation. Most users will want to consult the manual.
The API has mostly stayed the same, but not all the examples given there compile.
- module Database.Beam.Query
- module Database.Beam.Schema
- class (BeamBackend be, Monad m, MonadIO m, Sql92SanityCheck syntax) => MonadBeam syntax be handle m | m -> syntax be handle, be -> m, handle -> m where
- newtype Auto x = Auto {}
- class BeamBackend be => FromBackendRow be a where
- class Monad m => MonadIO (m :: * -> *) where
- class Typeable k (a :: k)
- class Generic a
- data Identity a :: * -> *
Documentation
module Database.Beam.Query
module Database.Beam.Schema
class (BeamBackend be, Monad m, MonadIO m, Sql92SanityCheck syntax) => MonadBeam syntax be handle m | m -> syntax be handle, be -> m, handle -> m where Source #
A class that ties together a Sql syntax, backend, handle, and monad type.
Functional dependencies mean that only the backend type or the handle need to be specified.
Intuitively, this allows you to write code that performs database commands
without having to know the underlying API. As long as you have an
appropriate handle from a database library that Beam can use, you can use
the MonadBeam
methods to execute the query.
Provided here is a low-level interface. Most often, you'll only need the
withDatabase
and withDatabaseDebug
function. 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.
:: (String -> IO ()) | Database statement logging function |
-> handle | The database connection handle against which to execute the action |
-> m a | The database action |
-> IO a |
Run a database action, and log debugging information about statements
executed using the specified IO
action.
withDatabase :: handle -> m a -> IO a Source #
Newtype wrapper for types that may be given default values by the database. Essentially, a wrapper around 'Maybe x'.
When a value of type 'Auto x' is written to a database (via INSERT
or
UPDATE
, for example), backends will translate a Nothing
value into an
expression that will evaluate to whatever default value the database would
choose. This is useful to insert rows with columns that are
auto-incrementable or have a DEFAULT
value.
When read from the database, the wrapped value will always be a Just
value. This isn't currently enforced at the type-level, but may be in
future versions of beam.
(BeamBackend be, FromBackendRow be (Maybe x)) => FromBackendRow be (Auto x) Source # | |
HasSqlValueSyntax Value (Maybe x) => HasSqlValueSyntax Value (Auto x) Source # | |
Eq x => Eq (Auto x) Source # | |
Ord x => Ord (Auto x) Source # | |
Read x => Read (Auto x) Source # | |
Show x => Show (Auto x) Source # | |
Generic (Auto x) Source # | |
Monoid x => Monoid (Auto x) Source # | |
ToJSON a => ToJSON (Auto a) Source # | |
FromJSON a => FromJSON (Auto a) Source # | |
type Rep (Auto x) Source # | |
class BeamBackend be => FromBackendRow be a where Source #
fromBackendRow :: FromBackendRowM be a Source #
fromBackendRow :: BackendFromField be a => FromBackendRowM be a Source #
Re-exports
The class Typeable
allows a concrete representation of a type to
be calculated.
typeRep#
Representable types of kind *. This class is derivable in GHC with the DeriveGeneric flag on.
Identity functor and monad. (a non-strict monad)
Since: 4.8.0.0