sitefox.db

Lightweight database access. The environment variable DATABASE_URL configures which database to connect to.

By default it is set to use a local sqlite database: sqlite://./database.sqlite

DATABASE_URL for Postgres: postgresql://[user[:password]@][netloc][:port][,...][/dbname][?param1=value1&...]

client

(client)

The database client that is connected to DATABASE_URL. This allows you to make raw queries against the database.

cljs-test-once-fixtures

database-url

default-page-size

ensure-local-postgres-db-exists

(ensure-local-postgres-db-exists & [db-url])

If DATABASE_URL is for a postgres url then create it if it does not already exist. An example of an on-disk db URL: ‘postgres://%2Fvar%2Frun%2Fpostgresql/DBNAME’.

f

(f kv-ns filter-function & [pre db])

Filter all key-value entries matching a particular namespace and prefix, through the supplied

kv

(kv kv-ns)

Access a database backed key-value store (Keyv instance). kv-ns is a namespace (i.e. table). The database to use can be configured with the DATABASE_URL environment variable. See the Keyv documentation for details. The promise based API has methods like (.set kv ...) and (.get kv ...) which do what you’d expect.

ls

(ls kv-ns & [pre db filter-function])

List all key-value entries matching a particular namespace and prefix. Returns a promise that resolves to rows of JSON objects containing the values.

  • kv-ns is the namespace/table name.
  • pre substring to filter key by i.e. keys matching kv-ns:pre....
  • db an database handle (defaults to the one defined in DATABASE_URL).
  • filter-function filter every value through this function, removing falsy results.

perform-select

(perform-select c select-statement deserialize kv-ns pre page-size page filter-function results)