sqlite-easy-1.0.0.0: A primitive yet easy to use sqlite library.
Safe HaskellSafe-Inferred
LanguageHaskell2010

Database.Sqlite.Easy.Internal

Description

The implementation of sqlite-easy.

This module is unstable and may change at any time.

Synopsis

Connection

newtype ConnectionString Source #

A SQLite3 connection string

Constructors

ConnectionString 

createSqlitePool :: ConnectionString -> IO (Pool Database) Source #

Create a pool of a sqlite3 db with a specific connection string.

withDb :: ConnectionString -> SQLite a -> IO a Source #

Open a database, run some stuff, close the database.

withDatabase :: Database -> SQLite a -> IO a Source #

Use an active database connection to run some stuff on a database.

withPool :: Pool Database -> SQLite a -> IO a Source #

Use a resource pool to run some stuff on a database.

Execution

newtype SQL Source #

A SQL statement

Constructors

SQL 

Fields

Instances

Instances details
IsString SQL Source # 
Instance details

Defined in Database.Sqlite.Easy.Internal

Methods

fromString :: String -> SQL #

Semigroup SQL Source # 
Instance details

Defined in Database.Sqlite.Easy.Internal

Methods

(<>) :: SQL -> SQL -> SQL #

sconcat :: NonEmpty SQL -> SQL #

stimes :: Integral b => b -> SQL -> SQL #

Show SQL Source # 
Instance details

Defined in Database.Sqlite.Easy.Internal

Methods

showsPrec :: Int -> SQL -> ShowS #

show :: SQL -> String #

showList :: [SQL] -> ShowS #

run :: SQL -> SQLite [[SQLData]] Source #

Run a SQL statement on a database and fetch the results.

runWith :: SQL -> [SQLData] -> SQLite [[SQLData]] Source #

Run a SQL statement with certain parameters on a database and fetch the results.

fetchAll :: Statement -> IO [[SQLData]] Source #

Run a statement and fetch all of the data.

Transaction

newtype SQLite a Source #

The type of actions to run on a SQLite database. In essence, it is almost the same as Database -> IO a.

SQLite actions can be created with the run and runWith functions, and can be composed using the type class instances.

SQLite actions can be run with the withDb, withDatabase, and withPool functions.

Constructors

SQLite 

Fields

Instances

Instances details
MonadFail SQLite Source # 
Instance details

Defined in Database.Sqlite.Easy.Internal

Methods

fail :: String -> SQLite a #

MonadIO SQLite Source # 
Instance details

Defined in Database.Sqlite.Easy.Internal

Methods

liftIO :: IO a -> SQLite a #

Applicative SQLite Source # 
Instance details

Defined in Database.Sqlite.Easy.Internal

Methods

pure :: a -> SQLite a #

(<*>) :: SQLite (a -> b) -> SQLite a -> SQLite b #

liftA2 :: (a -> b -> c) -> SQLite a -> SQLite b -> SQLite c #

(*>) :: SQLite a -> SQLite b -> SQLite b #

(<*) :: SQLite a -> SQLite b -> SQLite a #

Functor SQLite Source # 
Instance details

Defined in Database.Sqlite.Easy.Internal

Methods

fmap :: (a -> b) -> SQLite a -> SQLite b #

(<$) :: a -> SQLite b -> SQLite a #

Monad SQLite Source # 
Instance details

Defined in Database.Sqlite.Easy.Internal

Methods

(>>=) :: SQLite a -> (a -> SQLite b) -> SQLite b #

(>>) :: SQLite a -> SQLite b -> SQLite b #

return :: a -> SQLite a #

MonadUnliftIO SQLite Source # 
Instance details

Defined in Database.Sqlite.Easy.Internal

Methods

withRunInIO :: ((forall a. SQLite a -> IO a) -> IO b) -> SQLite b #

Monoid a => Monoid (SQLite a) Source # 
Instance details

Defined in Database.Sqlite.Easy.Internal

Methods

mempty :: SQLite a #

mappend :: SQLite a -> SQLite a -> SQLite a #

mconcat :: [SQLite a] -> SQLite a #

Semigroup a => Semigroup (SQLite a) Source # 
Instance details

Defined in Database.Sqlite.Easy.Internal

Methods

(<>) :: SQLite a -> SQLite a -> SQLite a #

sconcat :: NonEmpty (SQLite a) -> SQLite a #

stimes :: Integral b => b -> SQLite a -> SQLite a #

transaction :: forall a. Typeable a => SQLite a -> SQLite a Source #

Run operations as a transaction. If the action throws an error, the transaction is rolled back. For more information, visit: https://www.sqlite.org/lang_transaction.html

rollback :: Typeable a => a -> SQLite a Source #

Rollback the current (inner-most) transaction by supplying the return value. To be used inside transactions.

rollbackAll :: Typeable a => a -> SQLite a Source #

Rollback all transaction structure by supplying the return value. To be used inside transactions.

data RollbackAll a Source #

Constructors

RollbackAll a