Implementation of a custom next.jdbc
result set builder function, builder-fn
, and the default
implementation; [[reduce-result-set]] which is used to reduce results from JDBC databases.
Implementation of a custom `next.jdbc` result set builder function, [[builder-fn]], and the default implementation; [[reduce-result-set]] which is used to reduce results from JDBC databases.
(builder-fn conn₁ model₂ rset opts)
Return the next.jdbc
builder function to use to create the results when querying a model. By default, this
uses instance-builder-fn
, and returns Toucan 2 instances; but if you want to use plain maps you can use one of the
other builder functions that ships with next.jdbc
, or write your own custom builder function.
builder-fn is defined in toucan2.jdbc.result-set
(toucan2/jdbc/result_set.clj:25).
It caches methods using a methodical.impl.cache.watching.WatchingCache
.
It uses the method combination methodical.impl.combo.threaded.ThreadingMethodCombination
with the threading strategy :thread-last
.
It uses the dispatcher methodical.impl.dispatcher.multi_default.MultiDefaultDispatcher
with hierarchy #'clojure.core/global-hierarchy
and prefs {}
.
The default value is :default
.
It uses the method table methodical.impl.method_table.standard.StandardMethodTable
.
These primary methods are known:
:default
, defined in toucan2.jdbc.result-set
(toucan2/jdbc/result_set.clj:119)
It has the following documentation:
Default next.jdbc
builder function. Uses instance-builder-fn
to return Toucan 2 instances.
[:toucan2.jdbc.mysql-mariadb/connection :default]
, defined in [[toucan2.jdbc.mysql-mariadb]] (toucan2/jdbc/mysql_mariadb.clj:133)
It has the following documentation:
This is an icky hack for MariaDB/MySQL. Inserted rows come back with the newly inserted ID as :insert-id
rather than
the actual name of the primary key column. So tweak the :label-fn
we pass to next.jdbc
to rename :insert-id
to
the actual PK name we'd expect. This only works for tables with a single-column PK.
Return the `next.jdbc` builder function to use to create the results when querying a model. By default, this uses [[instance-builder-fn]], and returns Toucan 2 instances; but if you want to use plain maps you can use one of the other builder functions that ships with `next.jdbc`, or write your own custom builder function. builder-fn is defined in [[toucan2.jdbc.result-set]] (toucan2/jdbc/result_set.clj:25). It caches methods using a `methodical.impl.cache.watching.WatchingCache`. It uses the method combination `methodical.impl.combo.threaded.ThreadingMethodCombination` with the threading strategy `:thread-last`. It uses the dispatcher `methodical.impl.dispatcher.multi_default.MultiDefaultDispatcher` with hierarchy `#'clojure.core/global-hierarchy` and prefs `{}`. The default value is `:default`. It uses the method table `methodical.impl.method_table.standard.StandardMethodTable`. These primary methods are known: * `:default`, defined in [[toucan2.jdbc.result-set]] (toucan2/jdbc/result_set.clj:119) It has the following documentation: Default `next.jdbc` builder function. Uses [[instance-builder-fn]] to return Toucan 2 instances. * `[:toucan2.jdbc.mysql-mariadb/connection :default]`, defined in [[toucan2.jdbc.mysql-mariadb]] (toucan2/jdbc/mysql_mariadb.clj:133) It has the following documentation: This is an icky hack for MariaDB/MySQL. Inserted rows come back with the newly inserted ID as `:insert-id` rather than the actual name of the primary key column. So tweak the `:label-fn` we pass to `next.jdbc` to rename `:insert-id` to the actual PK name we'd expect. This only works for tables with a single-column PK.
(instance-builder-fn model rset opts)
Create a result set map builder function appropriate for passing as the :builder-fn
option to next.jdbc
that
will create toucan2.instance
s of model
using namespaces determined
by toucan2.model/table-name->namespace
.
Create a result set map builder function appropriate for passing as the `:builder-fn` option to `next.jdbc` that will create [[toucan2.instance]]s of `model` using namespaces determined by [[toucan2.model/table-name->namespace]].
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close