Liking cljdoc? Tell your friends :D

sql-file.middleware

A current database connection for a body of code, opened only when something first uses it.

with-db-connection (and wrap-db-connection, for a Ring-style handler) makes a database available to its body without opening a connection. The connection is opened the first time current-db-connection is called (by a query, a transaction, or anything else that needs it), kept for the rest of the body, and closed (returned to its pool, for a pooled database) when the body ends. A body that never uses the database never opens a connection.

A current database connection for a body of code, opened only when
something first uses it.

with-db-connection (and wrap-db-connection, for a Ring-style handler)
makes a database available to its body without opening a
connection. The connection is opened the first time
current-db-connection is called (by a query, a transaction, or
anything else that needs it), kept for the rest of the body, and
closed (returned to its pool, for a pooled database) when the body
ends. A body that never uses the database never opens a connection.
raw docstring

*db*clj

source

call-with-db-connectionclj

(call-with-db-connection db-connection f)

Call f with db-connection (a db-spec, such as a pool from sql-file.core/open-pool) available as the current database. A connection is opened only if f uses it, and is closed when f returns or throws. A db-spec that already has an open :connection is used as it is, and left open.

Call f with db-connection (a db-spec, such as a pool from
sql-file.core/open-pool) available as the current database. A
connection is opened only if f uses it, and is closed when f returns
or throws. A db-spec that already has an open :connection is used as
it is, and left open.
sourceraw docstring

call-with-db-transactionclj

(call-with-db-transaction fn)
source

current-db-connectionclj

(current-db-connection)

The current database, as a db-spec with an open :connection, connecting first if this is its first use. Fails if there is no current database.

The current database, as a db-spec with an open :connection,
connecting first if this is its first use. Fails if there is no
current database.
sourceraw docstring

dbclj

(db)
source

with-db-connectioncljmacro

(with-db-connection db-connection & body)
source

with-db-transactioncljmacro

(with-db-transaction & body)
source

wrap-db-connectionclj

(wrap-db-connection app db-connection)

Ring-style middleware: run each request with db-connection as the current database (see call-with-db-connection). Requests that don't use the database don't open a connection.

Ring-style middleware: run each request with db-connection as the
current database (see call-with-db-connection). Requests that don't
use the database don't open a connection.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
←Move to previous article
→Move to next article
Ctrl+/Jump to the search field
× close