Liking cljdoc? Tell your friends :D

railway-clj.async


!>cljmacro

(!> & body)

Asynchronous version of !>. Returns a channel containing a railway result.

Asynchronous version of !>.
Returns a channel containing a railway result.
sourceraw docstring

<|>cljmacro

(<|> ch alternative)

Asynchronous version of <|>. Try alternative on failure for async operations. Both value and alternative should be channels containing railway results.

Example: (<|> (go (failure "error")) (go (success 42))) => channel containing (success 42)

Asynchronous version of <|>.
Try alternative on failure for async operations.
Both value and alternative should be channels containing railway results.

Example:
(<|> (go (failure "error"))
      (go (success 42))) => channel containing (success 42)
sourceraw docstring

>-<cljmacro

(>-< ch success-fn failure-fn)

Asynchronous version of >-<. Branch processing based on success/failure for async operations. Both success-fn and failure-fn should return channels.

Example: (>-< (go (success 42)) #(go (str "Success: " %)) #(go (str "Error: " %))) => channel containing "Success: 42"

Asynchronous version of >-<.
Branch processing based on success/failure for async operations.
Both success-fn and failure-fn should return channels.

Example:
(>-< (go (success 42))
      #(go (str "Success: " %))
      #(go (str "Error: " %))) => channel containing "Success: 42"
sourceraw docstring

attemptcljmacro

(attempt f error-handler)

Asynchronous version of attempt. Creates a function that returns a channel and catches exceptions.

Asynchronous version of attempt.
Creates a function that returns a channel and catches exceptions.
sourceraw docstring

channel?clj

(channel? x)
source

eithercljmacro

(either pred then else)

Asynchronous version of either. Both then and else functions should return channels.

Asynchronous version of either.
Both then and else functions should return channels.
sourceraw docstring

guardcljmacro

(guard pred error-msg)

Asynchronous version of guard. Returns a function that returns a channel containing a railway result.

Asynchronous version of guard.
Returns a function that returns a channel containing a railway result.
sourceraw docstring

unwrap-channelclj

(unwrap-channel ch)

Takes a channel containing a railway result and returns a channel that will contain the unwrapped value or error.

Takes a channel containing a railway result and returns a channel
that will contain the unwrapped value or error.
sourceraw docstring

validateclj

(validate spec value)

Asynchronous version of validate. Returns a channel containing a railway result.

Asynchronous version of validate.
Returns a channel containing a railway result.
sourceraw docstring

|+clj

(|+ & fs)

Asynchronous version of |+. Chains multiple async functions in a railway pattern. Each function should return a channel containing a railway result.

Example: (def workflow (|+a validate-user-async check-permissions-async save-user-async)) (workflow user-data) => channel containing Success or Failure

Asynchronous version of |+.
Chains multiple async functions in a railway pattern.
Each function should return a channel containing a railway result.

Example:
(def workflow (|+a validate-user-async check-permissions-async save-user-async))
(workflow user-data) => channel containing Success or Failure
sourceraw docstring

|-|cljmacro

(|-| ch & fns)

Asynchronous version of |-|. Threads a railway error through async functions. Each function should return a channel containing a railway result.

Example: (|-| (go (failure {:msg "Error"})) #(go (failure (assoc % :timestamp "now")))) => channel containing updated failure

Asynchronous version of |-|.
Threads a railway error through async functions.
Each function should return a channel containing a railway result.

Example:
(|-| (go (failure {:msg "Error"}))
      #(go (failure (assoc % :timestamp "now")))) => channel containing updated failure
sourceraw docstring

|>cljmacro

(|> ch & fns)

Asynchronous version of |>. Threads a railway result through async functions. Each function should return a channel containing a railway result.

Example: (|> (go (success 5)) #(go (success (inc %))) #(go (success (double %)))) => channel containing (success 12)

Asynchronous version of |>.
Threads a railway result through async functions.
Each function should return a channel containing a railway result.

Example:
(|> (go (success 5))
     #(go (success (inc %)))
     #(go (success (double %)))) => channel containing (success 12)
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close