Module

Sqlite.Core

Package
purescript-sqlite
Repository
Risto-Stevcev/purescript-sqlite

#_OPEN_READONLY Source

#_OPEN_READWRITE Source

#_OPEN_CREATE Source

#DbMode Source

data DbMode

The file mode when connection to the database

Constructors

#modeToInt Source

#DbEvent Source

data DbEvent e a

Corresponds to a database event

Constructors

#SqlQuery Source

#SqlRow Source

type SqlRow a = forall e. Decode a => Aff (sqlite :: SQLITE | e) (Maybe a)

#SqlRows Source

type SqlRows a = forall e. Decode a => Aff (sqlite :: SQLITE | e) (Array a)

#setVerbose Source

setVerbose :: forall e. Eff (sqlite :: SQLITE | e) Unit

Sets the debug mode for sqlite to verbose

#connect Source

connect :: forall e. String -> DbMode -> Aff (sqlite :: SQLITE | e) DbConnection

#connectCached Source

connectCached :: forall e. String -> DbMode -> Aff (sqlite :: SQLITE | e) DbConnection

Uses sqlite's built-in cache to avoid opening the same database multiple times

#close Source

close :: forall e. DbConnection -> Aff (sqlite :: SQLITE | e) Unit

#RunResult Source

type RunResult = { lastID :: Int, changes :: Int }

"lastID" result value should be used only for INSERT queries, "changes" result value should be used only for UPDATE and DELETE queries.

#run Source

run :: forall e. DbConnection -> SqlQuery -> Aff (sqlite :: SQLITE | e) RunResult

#readRow Source

readRow :: forall a e. Decode a => Foreign -> Aff (sqlite :: SQLITE | e) a

#getOne Source

getOne :: forall a. DbConnection -> SqlQuery -> SqlRow a

#get Source

get :: forall a. DbConnection -> SqlQuery -> SqlRows a

#stmtPrepare Source

stmtPrepare :: forall e. DbConnection -> SqlQuery -> Aff (sqlite :: SQLITE | e) DbStatement

#stmtBind Source

stmtBind :: forall e. DbStatement -> SqlParams -> Aff (sqlite :: SQLITE | e) Unit

#stmtReset Source

stmtReset :: forall e. DbStatement -> Aff (sqlite :: SQLITE | e) Unit

#stmtFinalize Source

stmtFinalize :: forall e. DbStatement -> Aff (sqlite :: SQLITE | e) Unit

#stmtRun Source

stmtRun :: forall e. DbStatement -> SqlParams -> Aff (sqlite :: SQLITE | e) RunResult

#stmtGetOne Source

stmtGetOne :: forall a. DbStatement -> SqlParams -> SqlRow a

#stmtGet Source

stmtGet :: forall a. DbStatement -> SqlParams -> SqlRows a

#listen Source

listen :: forall e a. DbConnection -> DbEvent e a -> Eff e a

Listener for the database open event

#DbStatement Source

#DbConnection Source

#SQLITE Source

data SQLITE :: Effect

#DbListener Source

data DbListener :: # Effect -> Type

A boxed function that can be used as a listener. This is necessary due to the underling implementation of Eff functions.

#_dbListener Source

_dbListener :: forall e a b. (a -> Eff e b) -> DbListener e

Creates a DbListener from a normal PureScript Eff function for the listen function.

#_dbListenerFn2 Source

_dbListenerFn2 :: forall e a b c. (Fn2 a b (Eff e c)) -> DbListener e

Creates a DbListener for a callback that takes two arguments

#_setVerbose Source

_setVerbose :: forall e. Eff (sqlite :: SQLITE | e) Unit

#_connect Source

_connect :: forall e. Fn3 String Int Boolean (Aff (sqlite :: SQLITE | e) DbConnection)

#_close Source

_close :: forall e. DbConnection -> (Aff (sqlite :: SQLITE | e) Unit)

#_run Source

_run :: forall e. Fn2 DbConnection SqlQuery (Aff (sqlite :: SQLITE | e) RunResult)

#_getOne Source

_getOne :: forall e. Fn2 DbConnection SqlQuery (Aff (sqlite :: SQLITE | e) (Undefinable Foreign))

#_get Source

_get :: forall e. Fn2 DbConnection SqlQuery (Aff (sqlite :: SQLITE | e) (Array Foreign))

#_stmtPrepare Source

_stmtPrepare :: forall e. Fn2 DbConnection SqlQuery (Aff (sqlite :: SQLITE | e) DbStatement)

#_stmtBind Source

_stmtBind :: forall e. Fn2 DbStatement SqlParams (Aff (sqlite :: SQLITE | e) Unit)

#_stmtReset Source

_stmtReset :: forall e. DbStatement -> (Aff (sqlite :: SQLITE | e) Unit)

#_stmtFinalize Source

_stmtFinalize :: forall e. DbStatement -> (Aff (sqlite :: SQLITE | e) Unit)

#_stmtRun Source

_stmtRun :: forall e. Fn2 DbStatement SqlParams (Aff (sqlite :: SQLITE | e) RunResult)

#_stmtGetOne Source

#_stmtGet Source

_stmtGet :: forall e. Fn2 DbStatement SqlParams (Aff (sqlite :: SQLITE | e) (Array Foreign))

#_listen Source

_listen :: forall e a. Fn3 DbConnection String (DbListener e) (Eff e a)