Alia module bringing component and spec support. As a consumer, a CassandraRegistry record is provided.
CassandraRegistry instances are responsible for maintaining sessions to clusters.
Downstream consumers of this component can then provide a map of query functions and obtain a function which performs queries against the correct cluster and optional default query options.
See query-functions
for details on how to use it.
Alia module bringing component and spec support. As a consumer, a CassandraRegistry record is provided. CassandraRegistry instances are responsible for maintaining sessions to clusters. Downstream consumers of this component can then provide a map of query functions and obtain a function which performs queries against the correct cluster and optional default query options. See `query-functions` for details on how to use it.
(->opts nick config code-opts)
This should provide a solid way to parameterize interaction with
Cassandra. For each named query nick
we determine what options to
give to the query in the following way:
This should provide a solid way to parameterize interaction with Cassandra. For each named query `nick` we determine what options to give to the query in the following way: - We fetch defaults from the configuration provided query options - We merge code-local defaults for this query - We merge query-specific defaults from configuration
(->query nick session query-opts {:keys [statement opts]})
Get a function which executes a query, preparing the statement.
Get a function which executes a query, preparing the statement.
(cassandra-registry cluster-opts query-opts config)
A single cluster version of CassandraMultiClusterRegistry
A single cluster version of CassandraMultiClusterRegistry
(cluster-query-opts registry cluster-name)
Fetch query-options from configuration.
Fetch query-options from configuration.
(keyspace-session registry k keyspace)
Retrieve a Session
instance set to use a specific keyspace.
keyspace may be a keyword or string.
Retrieve a `Session` instance set to use a specific keyspace. keyspace may be a keyword or string.
(query! {:keys [query-fn]} & args)
Convenience function against a QueryRegistry to execute a named query.
See query-functions
for the behavior of the query function
Convenience function against a QueryRegistry to execute a named query. See `query-functions` for the behavior of the query function
(query-fn-map session queries query-opts)
Yield a map of query nickname to function executing the query.
Provided queries should be statements valid for alia/prepare
.
Yield a map of query nickname to function executing the query. Provided queries should be statements valid for `alia/prepare`.
(query-functions registry keyspace queries)
(query-functions registry cluster-name keyspace queries)
Given a cluster, keyspace, and query map, yield a function which executes queries by nickname. If no cluster-name is provided, assume a single-cluster registry and fetch the first from the registry.
The query function has three arities: 1, 2, and 3. The first argument is always the nickname, the optional second one is a vector of values to attach to the prepared query, the last one additional options to override when sending the query.
Here, options accept an addition :execute-fn
key which
determine which function should be used to send the
query out, defaulting to alia/execute
.
Each query can be configured with global configuration defaults,
code-supplied defaults, and query-specific configuration overrides,
processed in that order as documented in query
.
Given a cluster, keyspace, and query map, yield a function which executes queries by nickname. If no cluster-name is provided, assume a single-cluster registry and fetch the first from the registry. The query function has three arities: 1, 2, and 3. The first argument is always the nickname, the optional second one is a vector of values to attach to the prepared query, the last one additional options to override when sending the query. Here, options accept an addition `:execute-fn` key which determine which function should be used to send the query out, defaulting to `alia/execute`. Each query can be configured with global configuration defaults, code-supplied defaults, and query-specific configuration overrides, processed in that order as documented in `query`.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close