Liking cljdoc? Tell your friends :D

toucan2.pipeline

This is a low-level namespace implementing our query execution pipeline. Most of the stuff you'd use on a regular basis are implemented on top of stuff here.

This is a low-level namespace implementing our query execution pipeline. Most of the stuff you'd use on a regular basis
are implemented on top of stuff here.
raw docstring

*call-count-thunk*clj

Thunk function to call every time a query is executed if toucan2.execute/with-call-count is in use. Implementees of transduce-compiled-query-with-connection* should invoke this every time a query gets executed. You can use increment-call-count! to simplify the chore of making sure it's non-nil before invoking it.

Thunk function to call every time a query is executed if [[toucan2.execute/with-call-count]] is in use. Implementees
of [[transduce-compiled-query-with-connection*]] should invoke this every time a query gets executed. You can
use [[increment-call-count!]] to simplify the chore of making sure it's non-`nil` before invoking it.
sourceraw docstring

*transduce-built-query*clj

(*transduce-built-query* rf query-type model built-query)
source

*transduce-compiled-query*clj

(*transduce-compiled-query* rf query-type model compiled-query)
source

*transduce-compiled-query-with-connection*clj

(*transduce-compiled-query-with-connection* rf
                                            conn
                                            query-type
                                            model
                                            compiled-query)
source

*transduce-parsed-args*clj

(*transduce-parsed-args* rf query-type parsed-args)
source

*transduce-resolved-query*clj

(*transduce-resolved-query* rf query-type model parsed-args resolved-query)
source

*transduce-unparsed*clj

(*transduce-unparsed* rf query-type unparsed)
source

*transduce-with-model*clj

(*transduce-with-model* rf query-type model parsed-args)
source

base-query-typeclj

(base-query-type query-type)

E.g. something like :toucan.query-type/insert.*. The immediate descendant of :toucan.query-type/*.

(base-query-type :toucan.query-type/insert.instances)
=>
:toucan.query-type/insert.*
E.g. something like `:toucan.query-type/insert.*`. The immediate descendant of `:toucan.query-type/*`.

```clj
(base-query-type :toucan.query-type/insert.instances)
=>
:toucan.query-type/insert.*
```
sourceraw docstring

default-rfclj

(default-rf query-type)
source

define-out-transformcljmacro

(define-out-transform [query-type model-type] [instance-binding] & body)
source

do-traced-pipelineclj

(do-traced-pipeline thunk)
source

first-result-rfclj

(first-result-rf rf)
source

increment-call-count!clj

(increment-call-count!)
source

parent-query-typeclj

(parent-query-type query-type)
source

reducible-built-queryclj

(reducible-built-query query-type model built-query)
source

reducible-compiled-queryclj

(reducible-compiled-query query-type model compiled-query)
source

reducible-compiled-query-with-connectionclj

(reducible-compiled-query-with-connection conn query-type model compiled-query)
source

reducible-parsed-argsclj

(reducible-parsed-args query-type parsed-args)
source

reducible-resolved-queryclj

(reducible-resolved-query query-type model parsed-args resolved-query)
source

reducible-unparsedclj

(reducible-unparsed query-type unparsed)
source

reducible-with-modelclj

(reducible-with-model query-type model parsed-args)
source

similar-query-type-returningclj

(similar-query-type-returning query-type result-type)
(similar-query-type-returning :toucan.query-type/insert.instances :toucan.result-type/pks)
=>
:toucan.query-type/insert.pks
```clj
(similar-query-type-returning :toucan.query-type/insert.instances :toucan.result-type/pks)
=>
:toucan.query-type/insert.pks
```
sourceraw docstring

transduce-built-queryclj

(transduce-built-query rf query-type model built-query)
source

transduce-built-query*clj

(transduce-built-query* rf query-type₁ model₂ built-query₃)

The fifth step in the query execution pipeline. Called with a query that is ready to be compiled, e.g. a fully-formed Honey SQL form.

transduce-resolved-query*
↓
toucan2.query/with-built-query
↓
transduce-built-query* ← YOU ARE HERE
↓
toucan2.compile/with-compiled-query
↓
transduce-compiled-query*

The default implementation compiles the query with toucan2.compile/with-compiled-query and then calls transduce-compiled-query*.

The fifth step in the query execution pipeline. Called with a query that is ready to be compiled, e.g. a fully-formed
Honey SQL form.

```
transduce-resolved-query*
↓
toucan2.query/with-built-query
↓
transduce-built-query* ← YOU ARE HERE
↓
toucan2.compile/with-compiled-query
↓
transduce-compiled-query*
```

The default implementation compiles the query with [[toucan2.compile/with-compiled-query]] and then
calls [[transduce-compiled-query*]].
sourceraw docstring

transduce-compiled-queryclj

(transduce-compiled-query rf query-type model compiled-query)
source

transduce-compiled-query*clj

(transduce-compiled-query* rf query-type₁ model₂ compiled-query₃)

The sixth step in the query execution pipeline. Called with a compiled query that is ready to be executed natively, for example a [sql & args] vector, immediately before opening a connection.

transduce-built-query*
↓
toucan2.compile/with-compiled-query
↓
transduce-compiled-query* ← YOU ARE HERE
↓
toucan2.connection/with-connection
↓
transduce-compiled-query-with-connection*

The default implementation opens a connection (or uses the current connection) using toucan2.connection/with-connection and then calls transduce-compiled-query-with-connection*.

The sixth step in the query execution pipeline. Called with a compiled query that is ready to be executed natively, for
example a `[sql & args]` vector, immediately before opening a connection.

```
transduce-built-query*
↓
toucan2.compile/with-compiled-query
↓
transduce-compiled-query* ← YOU ARE HERE
↓
toucan2.connection/with-connection
↓
transduce-compiled-query-with-connection*
```

The default implementation opens a connection (or uses the current connection)
using [[toucan2.connection/with-connection]] and then calls [[transduce-compiled-query-with-connection*]].
sourceraw docstring

transduce-compiled-query-with-connectionclj

(transduce-compiled-query-with-connection rf
                                          conn
                                          query-type
                                          model
                                          compiled-query)
source

transduce-compiled-query-with-connection*clj

(transduce-compiled-query-with-connection* rf
                                           conn₁
                                           query-type₂
                                           model₃
                                           compiled-query)

The seventh and final step in the query execution pipeline. Called with a fully compiled query that can be executed natively, and an open connection for executing it.

transduce-compiled-query*
↓
toucan2.connection/with-connection
↓
transduce-compiled-query-with-connection* ← YOU ARE HERE
↓
execute query
↓
transduce results

Implementations should execute the query and transduce the results using rf. Implementations are database-specific, which is why this method dispatches off of connection type (e.g. java.sql.Connection). The default JDBC backend executes the query and reduces results with toucan2.jdbc.query/reduce-jdbc-query.

The seventh and final step in the query execution pipeline. Called with a fully compiled query that can be executed
natively, and an open connection for executing it.

```
transduce-compiled-query*
↓
toucan2.connection/with-connection
↓
transduce-compiled-query-with-connection* ← YOU ARE HERE
↓
execute query
↓
transduce results
```

Implementations should execute the query and transduce the results using `rf`. Implementations are database-specific,
which is why this method dispatches off of connection type (e.g. `java.sql.Connection`). The default JDBC backend
executes the query and reduces results with [[toucan2.jdbc.query/reduce-jdbc-query]].
sourceraw docstring

transduce-parsed-argsclj

(transduce-parsed-args rf query-type parsed-args)
source

transduce-parsed-args*clj

(transduce-parsed-args* rf query-type₁ parsed-args)

The second step in the query execution pipeline. Called with args as parsed by toucan2.query/parse-args.

transduce-unparsed*
↓
toucan2.query/parse-args
↓
transduce-parsed-args* ← YOU ARE HERE
↓
toucan2.model/with-model
↓
transduce-with-model*

The default implementation resolves the :modelable in parsed-args with toucan2.model/with-model and then calls transduce-with-model*.

The second step in the query execution pipeline. Called with args as parsed by [[toucan2.query/parse-args]].

```
transduce-unparsed*
↓
toucan2.query/parse-args
↓
transduce-parsed-args* ← YOU ARE HERE
↓
toucan2.model/with-model
↓
transduce-with-model*
```

The default implementation resolves the `:modelable` in `parsed-args` with [[toucan2.model/with-model]] and then
calls [[transduce-with-model*]].
sourceraw docstring

transduce-resolved-queryclj

(transduce-resolved-query rf query-type model parsed-args resolved-query)
source

transduce-resolved-query*clj

(transduce-resolved-query* rf query-type₁ model₂ parsed-args resolved-query₃)

The fourth step in the query execution pipeline. Called with a resolved query immediately before 'building' it.

transduce-with-model*
↓
toucan2.query/with-resolved-query
↓
transduce-resolved-query* ← YOU ARE HERE
↓
toucan2.query/with-built-query
↓
transduce-built-query*

The default implementation builds the resolved query with toucan2.query/with-built-query and then calls transduce-built-query*.

The fourth step in the query execution pipeline. Called with a resolved query immediately before 'building' it.

```
transduce-with-model*
↓
toucan2.query/with-resolved-query
↓
transduce-resolved-query* ← YOU ARE HERE
↓
toucan2.query/with-built-query
↓
transduce-built-query*
```

The default implementation builds the resolved query with [[toucan2.query/with-built-query]] and then
calls [[transduce-built-query*]].
sourceraw docstring

transduce-unparsedclj

(transduce-unparsed query-type unparsed)
(transduce-unparsed rf query-type unparsed)
source

transduce-unparsed*clj

(transduce-unparsed* rf query-type₁ unparsed)

The first step in the query execution pipeline. Called with the unparsed args as passed to something like toucan2.select/select, before parsing the args.

Entrypoint e.g. select/select
↓
transduce-unparsed*           ← YOU ARE HERE
↓
toucan2.query/parse-args
↓
transduce-parsed-args*

The default implementation parses the args with toucan2.query/parse-args and then calls transduce-parsed-args*.

The first step in the query execution pipeline. Called with the unparsed args as passed to something
like [[toucan2.select/select]], before parsing the args.

```
Entrypoint e.g. select/select
↓
transduce-unparsed*           ← YOU ARE HERE
↓
toucan2.query/parse-args
↓
transduce-parsed-args*
```

The default implementation parses the args with [[toucan2.query/parse-args]] and then
calls [[transduce-parsed-args*]].
sourceraw docstring

transduce-unparsed-first-resultclj

(transduce-unparsed-first-result query-type unparsed)
source

transduce-with-modelclj

(transduce-with-model rf query-type model parsed-args)
source

transduce-with-model*clj

(transduce-with-model* rf query-type₁ model₂ parsed-args)

The third step in the query execution pipeline. This is the first step that dispatches off of resolved model.

transduce-parsed-args*
↓
toucan2.model/with-model
↓
transduce-with-model* ← YOU ARE HERE
↓
toucan2.query/with-resolved-query
↓
transduce-resolved-query*

The default implementation resolves the queryable with toucan2.query/with-resolved-query and then calls transduce-resolved-query*.

The third step in the query execution pipeline. This is the first step that dispatches off of resolved model.

```
transduce-parsed-args*
↓
toucan2.model/with-model
↓
transduce-with-model* ← YOU ARE HERE
↓
toucan2.query/with-resolved-query
↓
transduce-resolved-query*
```

The default implementation resolves the queryable with [[toucan2.query/with-resolved-query]] and then
calls [[transduce-resolved-query*]].
sourceraw docstring

with-initclj

(with-init rf init)
source

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close