Liking cljdoc? Tell your friends :D

entity.sql.hug


bind-connectioncljmacro

(bind-connection conn sql-file options)

Bind a db connection returned from connect! to the collection of functions defined in sql-file, leaving the map of values to satisfy the query as the only parameter. If the connection is held in a dynamic variable it can be bound for use within a transaction.

Options should be a nested map of entity-opts, hug-opts and jdbc-opts each of which is a map of options at that level.

Returns an implementation of entity-core/IO.

Bind a db connection returned from connect! to the collection
of functions defined in sql-file, leaving the map of values to
satisfy the query as the only parameter. If the connection is
held in a dynamic variable it can be bound for use within a
transaction.

Options should be a nested map of entity-opts, hug-opts
and jdbc-opts each of which is a map of options at that level.

Returns an implementation of entity-core/IO.
sourceraw docstring

connect!clj

(connect! pool-spec)

Create a connection pool from the given pool-spec

Create a connection pool from the given pool-spec
sourceraw docstring

disconnect!clj

(disconnect! conn)

Close the connection pool, if not already closed.

Close the connection pool, if not already closed.
sourceraw docstring

make-configclj

(make-config {:keys [jdbc-url adapter datasource datasource-classname]
              :as pool-spec})

Validate a pool specification and support some alternative spec keys

Validate a pool specification and support some alternative spec keys
sourceraw docstring

make-sql-fnsclj

(make-sql-fns sql-file)
(make-sql-fns sql-file entity-opts)
(make-sql-fns sql-file entity-opts hug-opts)
(make-sql-fns sql-file entity-opts hug-opts jdbc-opts)

Process a SQL file turning its functions into ready-made queries. The file must include a snippet called select-stmt, which will be applied in usages of all queries.

  • entity-opts will be merged with the supplied parameter values when the function is called. These additional values may be used by SQL statements and the select snippet as required, for example to support SQL implementation specific choices.

  • hug-opts will be passed to the HugSQL generated function.

  • jdbc-opts will be passed to the HugSQL generated function, which in turn passes them to the underlying JDBC library call.

Process a SQL file turning its functions into ready-made queries. The
file must include a snippet called select-stmt, which will be applied
in usages of all queries.

  - entity-opts will be merged with the supplied parameter values when
    the function is called. These additional values may be used by
    SQL statements and the select snippet as required, for example to
    support SQL implementation specific choices.

  - hug-opts will be passed to the HugSQL generated function.

  - jdbc-opts will be passed to the HugSQL generated function, which
    in turn passes them to the underlying JDBC library call.
sourceraw docstring

with-transactioncljmacro

(with-transaction args & body)

Runs the body in a jdbc transaction using conn as the transaction connection. The isolation level and readonly status of the transaction may also be specified. (with-transaction [conn {:isolation level :read-only? true}] ... ) See clojure.java.jdbc/db-transaction* for more details on the transaction options.

Runs the body in a jdbc transaction using conn as the transaction connection.
The isolation level and readonly status of the transaction may also be specified.
(with-transaction [conn {:isolation level :read-only? true}]
  ... )
See clojure.java.jdbc/db-transaction* for more details on the transaction
options.
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