(close-datasource! db-name ds)Helper to safely close a standard physical datasource.
Helper to safely close a standard physical datasource.
(make-datasource db-name
db-dir
profile-key
&
[{:keys [batch-size batch-wait-ms builder-opts]
:or {batch-size 500 batch-wait-ms 10 builder-opts {}}}])Creates a HikariDataSource for the given physical database path. Ensures the parent directory exists before initialization.
Available profiles: :high-performance, :low-resource
Opts: :batch-size (default: 500) :batch-wait-ms (default: 10) :builder-opts (default: {}) - Global next.jdbc opts
Returns a map: {:datasource (HikariDataSource) :write-fn (fn [sql-vec & [opts]]): efficient writes. Blocking, waits for the result :write-async-fn fire-and-forget variant :migrate-fn (fn [classpath-prefix]): perform ragtime migration. call on setup :backup-fn (fn [backup-dir]): backup DB :close-fn (fn): - Closes the anchor, then the pool}
Creates a HikariDataSource for the given physical database path.
Ensures the parent directory exists before initialization.
Available profiles: :high-performance, :low-resource
Opts:
:batch-size (default: 500)
:batch-wait-ms (default: 10)
:builder-opts (default: {}) - Global next.jdbc opts
Returns a map:
{:datasource (HikariDataSource)
:write-fn (fn [sql-vec & [opts]]): efficient writes. Blocking, waits for the result
:write-async-fn fire-and-forget variant
:migrate-fn (fn [classpath-prefix]): perform ragtime migration. call on setup
:backup-fn (fn [backup-dir]): backup DB
:close-fn (fn): - Closes the anchor, then the pool}(make-in-memory-datasource
db-name
&
[{:keys [batch-size batch-wait-ms builder-opts]
:or {batch-size 500 batch-wait-ms 10 builder-opts {}}}])Creates an in-memory HikariDataSource. Automatically checks out an 'anchor' connection to prevent SQLite from destroying the shared memory database when the pool is completely idle.
db-name can be any string (e.g., a random UUID for test isolation).
Opts: :batch-size (default: 500) :batch-wait-ms (default: 10) :builder-opts (default: {}) - Global next.jdbc opts
Returns a map: {:datasource (HikariDataSource) :write-fn (fn [sql-vec & [opts]]): efficient writes. Blocking, waits for the result :write-async-fn fire-and-forget variant :migrate-fn (fn [classpath-prefix]): perform ragtime migration. call on setup :backup-fn (fn [backup-dir]): backup DB :close-fn (fn): - Closes the anchor, then the pool}
Creates an in-memory HikariDataSource. Automatically checks out an
'anchor' connection to prevent SQLite from destroying the shared memory
database when the pool is completely idle.
`db-name` can be any string (e.g., a random UUID for test isolation).
Opts:
:batch-size (default: 500)
:batch-wait-ms (default: 10)
:builder-opts (default: {}) - Global next.jdbc opts
Returns a map:
{:datasource (HikariDataSource)
:write-fn (fn [sql-vec & [opts]]): efficient writes. Blocking, waits for the result
:write-async-fn fire-and-forget variant
:migrate-fn (fn [classpath-prefix]): perform ragtime migration. call on setup
:backup-fn (fn [backup-dir]): backup DB
:close-fn (fn): - Closes the anchor, then the pool}cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |