stillsuit.core
Main public API for stillsuit.
For more details, see the user manual.
Note that this namespace constitutes the entirety of the public API; all the other namespaces in stillsuit can be considered to be implementation details and may change over time.
connection
(connection app-context)
Given a stillsuit-decorated app context, return the datomic connection object that was associated with the context at the time (stillsuit/decorate)
was called.
Parameters:
app-context
: the lacinia application context (first argument to a resolver function)
For more information, see the user manual.
datomic-enum
(datomic-enum app-context lacinia-type lacinia-enum-keyword)
Given a stillsuit-decorated app context and a keyword representing a lacinia enum which has been described in the stillsuit config, return the keyword corresponding to the datomic value for that keyword.
Parameters:
app-context
: the lacinia application context (first argument to a resolver function)lacinia-type
: the keyword corresponding to a lacinia:enum
definitionlacinia-enum-keyword
: a keyword representing the value we’re trying to convert to its datomic equivalent
For more information, see the user manual.
db
(db app-context)
Given a stillsuit-decorated app context, get the most recent datomic db value from its datomic connection.
Parameters:
app-context
: the lacinia application context (first argument to a resolver function)
For more information, see the user manual.
decorate
(decorate #:stillsuit{:keys [schema config resolvers transformers context connection]})
Main interface to stillsuit. Accepts a map containing various parameters as input; returns a map with an app context and a schema. The map can be passed to execute in order to invoke lacinia with its configuration.
The single argument to (decorate)
should be a map with the following keys:
:stillsuit/schema
: a normal lacinia schema definition.:stillsuit/connection
: a datomic connection object.:stillsuit/resolvers
: a map of keywords to resolver function objects, identical to the map you’d pass to(lacinia.util/attach-resolvers)
.:stillsuit/config
(optional): a map of configuration options for stillsuit.:stillsuit/context
(optional): a map containing any custom information your resolvers need, identical to thecontext
argument you’d pass to(lacinia/execute)
.:stillsuit/transformers
(optional): a map of keywords to scalar transformer function objects, identical to the map you’d pass to(lacinia.util/attach-scalar-transformers)
.
The return value of this function is a map with two keys:
:stillsuit/schema
: the compiled, transformed schema definition:stillsuit/app-context
: an application context object
These two data structures can be passed to (lacinia/execute)
directly, or there is a simple wrapper function execute that will invoke lacinia for you.
For more information, see the user manual.
execute
(execute stillsuit-result query)
(execute stillsuit-result query variables)
Convenience function to take the result of decorate and execute a query against it. The query
and variables
parameters are the same ones that would be passed to (lacinia.core/execute)
.
For more information, see the user manual.