Liking cljdoc? Tell your friends :D

wagoe.platform.shell.adapters.database.common.adapter

One DBAdapter implementation, over a per-engine spec.

There used to be four, and they were copies: each query.clj was the same sixty lines turning on two decisions, and each core.clj was thirty lines of delegation. A fix landed in one and not its neighbours — that is how H2 came to carry a table-exists? workaround while SQLite and MySQL reported every table as absent (BOU-430).

A spec names what the port says may differ between engines, and nothing else:

:label for log lines — "MySQL" :dialect what callers dispatch on; nil means PostgreSQL :driver JDBC driver class name :jdbc-url (fn [db-config] -> String) :pool HikariCP defaults :session-statements (fn [db-config] -> seq of JDBC param vectors) :booleans :native or :int :string-match :like or :ilike :table-exists? (fn [datasource table-name] -> boolean) :table-info (fn [datasource table-name] -> vector of column maps) :unique-keys optional (fn [datasource table-name] -> vector of column-name vectors); without one, read from the JDBC metadata :engine :postgresql, :mysql, :sqlite or :h2 :capabilities a subset of protocols/capability-keywords :column-types {logical-type DDL-type} for protocols/logical-column-types; a string is VARCHAR(length) unless :string names one type for all :now-ms-sql SQL for the database clock in epoch millis :on-connect optional (fn [java.sql.Connection]), run on each new connection after the session statements :param->db optional (fn [value] -> value) for each query parameter; without one, instant->iso :db->value optional (fn [value] -> value) for each value read

One `DBAdapter` implementation, over a per-engine spec.

There used to be four, and they were copies: each `query.clj` was the same
sixty lines turning on two decisions, and each `core.clj` was thirty lines of
delegation. A fix landed in one and not its neighbours — that is how H2 came
to carry a `table-exists?` workaround while SQLite and MySQL reported every
table as absent (BOU-430).

A spec names what the port says may differ between engines, and nothing else:

  :label              for log lines — "MySQL"
  :dialect            what callers dispatch on; nil means PostgreSQL
  :driver             JDBC driver class name
  :jdbc-url           (fn [db-config] -> String)
  :pool               HikariCP defaults
  :session-statements (fn [db-config] -> seq of JDBC param vectors)
  :booleans           :native or :int
  :string-match       :like or :ilike
  :table-exists?      (fn [datasource table-name] -> boolean)
  :table-info         (fn [datasource table-name] -> vector of column maps)
  :unique-keys        optional (fn [datasource table-name] -> vector of column-name
                      vectors); without one, read from the JDBC metadata
  :engine             :postgresql, :mysql, :sqlite or :h2
  :capabilities       a subset of protocols/capability-keywords
  :column-types       {logical-type DDL-type} for protocols/logical-column-types;
                      a string is VARCHAR(length) unless :string names one type for all
  :now-ms-sql         SQL for the database clock in epoch millis
  :on-connect         optional (fn [java.sql.Connection]), run on each new
                      connection after the session statements
  :param->db          optional (fn [value] -> value) for each query parameter;
                      without one, `instant->iso`
  :db->value          optional (fn [value] -> value) for each value read
raw docstring

wagoe.platform.shell.adapters.database.common.connection

Common connection pool management utilities.

Common connection pool management utilities.
raw docstring

wagoe.platform.shell.adapters.database.common.core

Common database operations - main coordination module.

This namespace serves as the main coordinator for common database functionality, bringing together specialized modules for different aspects of database operations that work across all adapter types.

The common functionality has been refactored into specialized namespaces:

  • common.connection: Connection pool management with HikariCP
  • common.execution: Query execution with logging and error handling
  • common.schema: Schema introspection and DDL execution
  • common.utils: Database information and convenience functions
  • common.core: Main coordination module (this namespace)

Pure query building functions are now in wagoe.platform.core.database.query

This modular structure provides:

  • Better organization with focused responsibilities
  • Easier maintenance and testing
  • Consistent patterns across all database adapters
  • Clear separation of concerns
Common database operations - main coordination module.

This namespace serves as the main coordinator for common database
functionality, bringing together specialized modules for different
aspects of database operations that work across all adapter types.

The common functionality has been refactored into specialized namespaces:
- common.connection: Connection pool management with HikariCP
- common.execution: Query execution with logging and error handling
- common.schema: Schema introspection and DDL execution
- common.utils: Database information and convenience functions
- common.core: Main coordination module (this namespace)

Pure query building functions are now in wagoe.platform.core.database.query

This modular structure provides:
- Better organization with focused responsibilities
- Easier maintenance and testing
- Consistent patterns across all database adapters
- Clear separation of concerns
raw docstring

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

wagoe.platform.shell.adapters.database.common.introspection

Table introspection for every adapter.

PostgreSQL, MySQL and H2 all read information_schema and differ only in which schema predicate identifies "this database", which HoneySQL dialect formats the query, and whether the table name may be folded to lower case. SQLite has no information_schema and reads sqlite_master and PRAGMA table_xinfo instead.

Both forms return the same column maps — :name (lower case), :type, :not-null, :default, :primary-key, :generated, :generated-always, :max-length (a character column's declared length, nil on SQLite) — which is what the port promises and what the four separate copies did not consistently deliver.

Table introspection for every adapter.

PostgreSQL, MySQL and H2 all read `information_schema` and differ only in
which schema predicate identifies "this database", which HoneySQL dialect
formats the query, and whether the table name may be folded to lower case.
SQLite has no `information_schema` and reads `sqlite_master` and
`PRAGMA table_xinfo` instead.

Both forms return the same column maps — `:name` (lower case), `:type`,
`:not-null`, `:default`, `:primary-key`, `:generated`, `:generated-always`,
`:max-length` (a character column's declared length, nil on SQLite) —
which is what the port promises and what the four separate copies did not
consistently deliver.
raw docstring

wagoe.platform.shell.adapters.database.common.utils

Common database utilities and information functions.

Common database utilities and information functions.
raw 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