clj-r2dbc.datafy

REPL navigation support for clj-r2dbc rows.

Loading this namespace extends Navigable for all IPersistentMap instances.
Navigation is gated by marker metadata set by
clj-r2dbc.impl.datafy/attach-datafiable-meta, so only rows returned with
:datafy true in opts are navigable.

Provides:
  nav-task - returns a Missionary task for async row navigation.
  nav      - blocking navigation helper for REPL tooling.

nav

added in 0.1

(nav row k v & {:as opts})
Navigate a row synchronously for REPL tooling.

Args:
  row  - navigable row map with :datafy metadata.
  k    - key navigated from the row.
  v    - value at k.
  opts - (optional) options map; defaults to {}.
           :nav-timeout-ms - timeout in milliseconds (default 5000).
         Accepts a map, keyword arguments, or both.

Returns the navigation result or nil.

Throws (synchronously):
  ex-info :clj-r2dbc/timeout when :nav-timeout-ms elapses.

Example:
  (nav row :id 1)
  (nav row :id 1 {:nav-timeout-ms 2000})

nav-task

added in 0.1

(nav-task row k v & {:as opts})
Return a Missionary task for row navigation.

Delegates to the :nav-fn stored in the row's metadata by
clj-r2dbc.impl.datafy/attach-datafiable-meta. Returns a task yielding nil
when no :nav-fn is present.

Args:
  row  - navigable row map with :datafy metadata.
  k    - key navigated from the row.
  v    - value at k.
  opts - (optional) options map; defaults to {}.
           :nav-timeout-ms - timeout in milliseconds (default 5000).
         Accepts a map, keyword arguments, or both.

Returns a Missionary task resolving to the navigation result or nil.

Example:
  (m/? (nav-task row :id 1))
  (m/? (nav-task row :id 1 {:nav-timeout-ms 2000}))