Liking cljdoc? Tell your friends :D

wagoe.platform.shell.adapters.database.common.execution

Query execution with I/O, logging, and error handling.

This is part of the imperative shell - it performs database I/O, manages transactions, and handles side effects like logging.

Query execution with I/O, logging, and error handling.

This is part of the imperative shell - it performs database I/O,
manages transactions, and handles side effects like logging.
raw docstring

*transaction-datasource*clj

Bound transaction connection used by database execution helpers.

This ensures all nested database calls inside a transaction share the same JDBC connection instead of borrowing a new one from the pool.

Bound transaction connection used by database execution helpers.

This ensures all nested database calls inside a transaction share the same
JDBC connection instead of borrowing a new one from the pool.
sourceraw docstring

current-datasourceclj

(current-datasource ctx)

Return the active JDBC executor for the current call.

Prefer a transaction-bound connection when present so transaction-scoped settings like PostgreSQL search_path remain in effect for all downstream queries.

Return the active JDBC executor for the current call.

Prefer a transaction-bound connection when present so transaction-scoped
settings like PostgreSQL `search_path` remain in effect for all downstream
queries.
sourceraw docstring

db-context?clj

Check if value is a valid database context.

Delegates to pure core function.

Check if value is a valid database context.

Delegates to pure core function.
sourceraw docstring

execute-batch!clj

(execute-batch! ctx query-maps)

Execute multiple queries in a single transaction.

Args: ctx: Database context query-maps: Vector of HoneySQL query maps

Returns: Vector of results (for SELECTs) or affected row counts (for updates)

Example: (execute-batch! ctx [{:insert-into :users :values [{:name "John"}]} {:insert-into :users :values [{:name "Jane"}]}])

Execute multiple queries in a single transaction.

Args:
  ctx: Database context
  query-maps: Vector of HoneySQL query maps

Returns:
  Vector of results (for SELECTs) or affected row counts (for updates)

Example:
  (execute-batch! ctx [{:insert-into :users :values [{:name "John"}]}
                      {:insert-into :users :values [{:name "Jane"}]}])
sourceraw docstring

execute-one!clj

(execute-one! ctx query-map)

Execute query expecting single result.

Args: ctx: Database context query-map: HoneySQL query map

Returns: Single result map or nil

Example: (execute-one! ctx {:select [:*] :from [:users] :where [:= :id "123"]})

Execute query expecting single result.

Args:
  ctx: Database context
  query-map: HoneySQL query map

Returns:
  Single result map or nil

Example:
  (execute-one! ctx {:select [:*] :from [:users] :where [:= :id "123"]})
sourceraw docstring

execute-query!clj

(execute-query! ctx query-map)

Execute SELECT query and return results.

SHELL FUNCTION: Performs database I/O and logging (side effects). Uses pure core functions for query formatting.

Args: ctx: Database context {:datasource ds :adapter adapter} query-map: HoneySQL query map

Returns: Vector of result maps

Example: (execute-query! ctx {:select [:*] :from [:users] :where [:= :active true]})

Execute SELECT query and return results.

SHELL FUNCTION: Performs database I/O and logging (side effects).
Uses pure core functions for query formatting.

Args:
  ctx: Database context {:datasource ds :adapter adapter}
  query-map: HoneySQL query map

Returns:
  Vector of result maps

Example:
  (execute-query! ctx {:select [:*] :from [:users] :where [:= :active true]})
sourceraw docstring

execute-update!clj

(execute-update! ctx query-map)

Execute UPDATE/INSERT/DELETE query.

SHELL FUNCTION: Performs database I/O and logging (side effects).

Args: ctx: Database context query-map: HoneySQL query map

Returns: Number of affected rows

Example: (execute-update! ctx {:update :users :set {:active false} :where [:= :id "123"]})

Execute UPDATE/INSERT/DELETE query.

SHELL FUNCTION: Performs database I/O and logging (side effects).

Args:
  ctx: Database context
  query-map: HoneySQL query map

Returns:
  Number of affected rows

Example:
  (execute-update! ctx {:update :users :set {:active false} :where [:= :id "123"]})
sourceraw docstring

validate-adapterclj

Validate that context has a valid adapter.

Delegates to pure core function.

Validate that context has a valid adapter.

Delegates to pure core function.
sourceraw docstring

validate-contextclj

Validate database context and throw if invalid.

Delegates to pure core function.

Validate database context and throw if invalid.

Delegates to pure core function.
sourceraw docstring

with-transaction*clj

(with-transaction* ctx f)

Execute function within database transaction context.

Args: ctx: Database context f: Function that takes transaction context and returns result

Returns: Result of function execution

Example: (with-transaction* ctx (fn [tx] (execute-update! tx query)))

Execute function within database transaction context.

Args:
  ctx: Database context
  f: Function that takes transaction context and returns result

Returns:
  Result of function execution

Example:
  (with-transaction* ctx (fn [tx] (execute-update! tx query)))
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