(->serializable config)Transforms an adapter configuration into a serializable form, replacing every function it contains with a :ref/... keyword the developer must resupply when reimporting the configuration. :middlewares is replaced as a single whole :ref (not walked into); :auth and :network-config are walked recursively so every nested handler gets its own indexed :ref. Args:
Transforms an adapter configuration into a serializable form, replacing every function it contains with a :ref/... keyword the developer must resupply when reimporting the configuration. :middlewares is replaced as a single whole :ref (not walked into); :auth and :network-config are walked recursively so every nested handler gets its own indexed :ref. Args: - config : An adapter configuration map (as accepted by ehr-adapter.schema/AdapterConfiguration). Returns: A new configuration map with the same shape, safe to serialize to EDN or transit+json.
(export! config opts)Validates and serializes an adapter configuration, replacing every embedded function with a :ref/... keyword the developer must resupply when reimporting. Writes the result to disk if :dir and/or :file-name are given in opts; otherwise returns the serialized text in memory. Args:
Validates and serializes an adapter configuration, replacing every
embedded function with a :ref/... keyword the developer must resupply
when reimporting. Writes the result to disk if :dir and/or :file-name
are given in opts; otherwise returns the serialized text in memory.
Args:
- config : An adapter configuration map (as accepted by ehr-adapter.schema/AdapterConfiguration).
- opts : {:format :edn|:transit, :dir (optional), :file-name (optional)}.
When :dir/:file-name are omitted, nothing is written to disk.
Returns:
The serialized string (EDN or transit+json) when no destination is given,
or the java.io.File written to disk otherwise.
Throws:
:invalid/format if opts :format has no registered writer.(import opts)Reads a previously exported configuration file back into Clojure data, without resolving any :ref/... keyword (that's the caller's responsibility, typically when feeding the config to the adapter's initialize step). Args:
Reads a previously exported configuration file back into Clojure data,
without resolving any :ref/... keyword (that's the caller's responsibility,
typically when feeding the config to the adapter's initialize step).
Args:
- opts : {:format :edn|:transit, :file (a java.io.File)}, or
{:format :edn|:transit, :dir (optional), :file-name}, where
:file-name alone (no :dir) looks up the file in the current
working directory.
Returns:
The Clojure data read from the file, as produced by ->serializable
before it was written to disk.
Throws:
:missing/file if the resolved file doesn't exist;
:invalid/format if opts :format has no registered reader.(path->ref path)Builds a :ref keyword from a sequence of keys/indices representing a location inside the configuration map. Args:
Builds a :ref keyword from a sequence of keys/indices representing a location inside the configuration map. Args: - path : A vector of keywords and/or integers (e.g. [:auth :initial 0 :handler]). Returns: A namespaced :ref/... keyword joining the path segments with dots, or nil if path is empty.
(walk x path)Recursively walks a value, replacing any function found with the :ref keyword corresponding to its location in the structure. Args:
Recursively walks a value, replacing any function found with the :ref keyword corresponding to its location in the structure. Args: - x : The value to walk (map, vector, function, or scalar). - path : The path accumulated so far to reach x. Returns: x unchanged if it has no functions inside; a :ref keyword if x itself is a function; or a structurally-equal map/vector with every nested function replaced by its :ref.
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 |