HORIZON HASKELLDocslts/ghc-9.10.xc74966e2026-09-27Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27

Moduleselda-0.5.2.1Haskell2010

Database.Selda.Backend

API for building Selda backends and adding support for more types in queries.

  • 18 types
  • 1 class
  • 16 values
  • Packageselda-0.5.2.1
  • Exports35
  • LanguageHaskell2010
  • LicenceMIT
  • SourceBackend.hs
classclass MonadIO m => MonadSelda (m :: Type -> Type) where
#

Some monad with Selda SQL capabilitites.

Associated types

Methods

  • withConnection :: (SeldaConnection (Backend m) -> m a) -> m a

    Pass a Selda connection to the given computation and execute it. After the computation finishes, withConnection is free to do anything it likes to the connection, including closing it or giving it to another Selda computation. Thus, the computation must take care never to return or otherwise access the connection after returning.

  • transact :: m a -> m a

    Perform the given computation as a transaction. Implementations must ensure that subsequent calls to withConnection within the same transaction always passes the same connection to its argument.

Instances1MonadSelda
newtypenewtype SeldaT b (m :: Type -> Type) a
#

Monad transformer adding Selda SQL capabilities.

Instances11MonadTrans, Monad, Functor, MonadFail, Applicative, MonadIO, …
datadata SeldaError
#

Thrown by any function in SeldaT if an error occurs.

Constructors

Instances3Eq, Show, Exception
  • Eq SeldaErrorDefined in selda-0.5.2.1 · Database.Selda.Backend.Internal
  • Show SeldaErrorDefined in selda-0.5.2.1 · Database.Selda.Backend.Internal
  • Exception SeldaErrorDefined in selda-0.5.2.1 · Database.Selda.Backend.Internal
newtypenewtype StmtID
#

A prepared statement identifier. Guaranteed to be unique per application.

Instances3Eq, Ord, Show
  • Eq StmtIDDefined in selda-0.5.2.1 · Database.Selda.Backend.Internal
  • Ord StmtIDDefined in selda-0.5.2.1 · Database.Selda.Backend.Internal
  • Show StmtIDDefined in selda-0.5.2.1 · Database.Selda.Backend.Internal
datadata BackendID
#

Uniquely identifies some particular backend.

When publishing a new backend, consider submitting a pull request with a constructor for your backend instead of using the Other constructor.

Instances3Eq, Ord, Show
  • Eq BackendIDDefined in selda-0.5.2.1 · Database.Selda.Backend.Internal
  • Ord BackendIDDefined in selda-0.5.2.1 · Database.Selda.Backend.Internal
  • Show BackendIDDefined in selda-0.5.2.1 · Database.Selda.Backend.Internal
typetype QueryRunner a = Text -> [Param] -> IO a
#

A function which executes a query and gives back a list of extensible tuples; one tuple per result row, and one tuple element per column.

datadata SeldaBackend b
#

A collection of functions making up a Selda backend.

Constructors

datadata IndexMethod
#

Method to use for indexing with indexedUsing. Index methods are ignored by the SQLite backend, as SQLite doesn't support different index methods.

Instances3Eq, Ord, Show
datadata Param where
#

A parameter to a prepared SQL statement.

Constructors

Instances3Eq, Ord, Show
  • Eq ParamDefined in selda-0.5.2.1 · Database.Selda.SQL
  • Ord ParamDefined in selda-0.5.2.1 · Database.Selda.SQL
  • Show ParamDefined in selda-0.5.2.1 · Database.Selda.SQL
datadata ColAttr
#

Column attributes such as nullability, auto increment, etc. When adding elements, make sure that they are added in the order required by SQL syntax, as this list is only sorted before being pretty-printed.

Instances3Eq, Ord, Show
  • Eq ColAttrDefined in selda-0.5.2.1 · Database.Selda.Table.Type
  • Ord ColAttrDefined in selda-0.5.2.1 · Database.Selda.Table.Type
  • Show ColAttrDefined in selda-0.5.2.1 · Database.Selda.Table.Type
datadata PPConfig
#

Backend-specific configuration for the SQL pretty-printer.

Constructors

valuedefPPConfig :: PPConfig
#

Default settings for pretty-printing. Geared towards SQLite.

The default definition of ppTypePK is 'defType, so that you don’t have to do anything special if you don’t use special types for primary keys.

newtypenewtype TableName
#

Name of a database table.

Instances4Eq, Ord, Show, IsString
newtypenewtype ColName
#

Name of a database column.

Instances4Eq, Ord, Show, IsString
  • Eq ColNameDefined in selda-0.5.2.1 · Database.Selda.Types
  • Ord ColNameDefined in selda-0.5.2.1 · Database.Selda.Types
  • Show ColNameDefined in selda-0.5.2.1 · Database.Selda.Types
  • IsString ColNameDefined in selda-0.5.2.1 · Database.Selda.Types
datadata TableInfo
#

Comprehensive information about a table.

Constructors

Instances2Eq, Show
  • Eq TableInfoDefined in selda-0.5.2.1 · Database.Selda.Backend.Internal
  • Show TableInfoDefined in selda-0.5.2.1 · Database.Selda.Backend.Internal
datadata ColumnInfo
#

Comprehensive information about a column.

Constructors

Instances2Eq, Show
  • Eq ColumnInfoDefined in selda-0.5.2.1 · Database.Selda.Backend.Internal
  • Show ColumnInfoDefined in selda-0.5.2.1 · Database.Selda.Backend.Internal
valueseldaClose :: MonadIO m => SeldaConnection b -> m ()
#

Close a reusable Selda connection. Closing a connection while in use is undefined. Passing a closed connection to runSeldaT results in a SeldaError being thrown. Closing a connection more than once is a no-op.