Liking cljdoc? Tell your friends :D

sturdy.sqlite.core


close-datasource!clj

(close-datasource! db-name ds)

Helper to safely close a standard physical datasource.

Helper to safely close a standard physical datasource.
sourceraw docstring

close-in-memory-datasource!clj

(close-in-memory-datasource! db-name ds anchor)
source

make-datasourceclj

(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}
sourceraw docstring

make-in-memory-datasourceclj

(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}
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