($next)
Bump the index and produce a '$n' string.
Bump the index and produce a '$n' string.
($wrap f)
Wrap a function into the binding macro to make
the $next
function work.
Wrap a function into the binding macro to make the `$next` function work.
The current index of $1, ... $n placeholders.
The current index of $1, ... $n placeholders.
(def-db-fns file)
(def-db-fns file defaults)
(def-db-fns file defaults options)
Read and inject functions from a .sql file.
Acts like hugsql.core/def-db-fns
but overrides
some internal steps.
It automatically creates a PG2-related adapter and assigns it to the newly created functions.
Arguments:
file
is either a string, or a resource, or a file
object which is the source of .sql payload;
defaults
is a map of arguments what will be passed
to pg.core/execute
on each call. See the PG2 readme file
for more details;
options
is map of HugSQL options. It's unlikely you
will need to use it.
Once this function is called, functions from the .sql file appear in the current namespace. Each function has the following signature:
[db] [db params] [db params opt], where:
db
is either a connection config map, or a connection,
or a pool. If it was config map, the connection gets closed
afterwards. When it's a pool, the connection is borrowed from
it and then returned;
params
is the standard HugSQL map of SQL parameters;
opt
: pg2-specific arguments that are passed to the
pg.core/execute
function. They will override the defaults
passed to the def-db-fns
call.
Read and inject functions from a .sql file. Acts like `hugsql.core/def-db-fns` but overrides some internal steps. It automatically creates a PG2-related adapter and assigns it to the newly created functions. Arguments: - `file` is either a string, or a resource, or a file object which is the source of .sql payload; - `defaults` is a map of arguments what will be passed to `pg.core/execute` on each call. See the PG2 readme file for more details; - `options` is map of HugSQL options. It's unlikely you will need to use it. Once this function is called, functions from the .sql file appear in the current namespace. Each function has the following signature: [db] [db params] [db params opt], where: - `db` is either a connection config map, or a connection, or a pool. If it was config map, the connection gets closed afterwards. When it's a pool, the connection is borrowed from it and then returned; - `params` is the standard HugSQL map of SQL parameters; - `opt`: pg2-specific arguments that are passed to the `pg.core/execute` function. They will override the defaults passed to the `def-db-fns` call.
(intern-function fn-name fn-meta fn-obj)
Inject a function produced by HugSQL into the current namespace.
Inject a function produced by HugSQL into the current namespace.
(make-adapter)
(make-adapter defaults)
Initiate an adapter object. The defaults, when specified,
are passed to the pg.core/execute
function.
Initiate an adapter object. The defaults, when specified, are passed to the `pg.core/execute` function.
(wrap-signature f)
Slightly correct the signature of a function
produced by HugSQL. Namely, pass pg.core/execute
parameters through a dedicated key to prevent
merging them with something else.
Slightly correct the signature of a function produced by HugSQL. Namely, pass `pg.core/execute` parameters through a dedicated key to prevent merging them with something else.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close