(-> expr & forms)
This macro is the same as clojure.core/some->
, but the check is done
using the predicate error?
of the IUnifiedResponse
protocol and
the substitution occurs as in macro ->
(the thread-first
macro).
This macro is the same as `clojure.core/some->`, but the check is done using the predicate `error?` of the `IUnifiedResponse` protocol and the substitution occurs as in macro `->` (the `thread-first` macro).
(->> expr & forms)
This macro is the same as clojure.core/some->
, but the check is done
using the predicate error?
of the IUnifiedResponse
protocol and
the substitution occurs as in macro ->>
(the thread-last
macro).
This macro is the same as `clojure.core/some->`, but the check is done using the predicate `error?` of the `IUnifiedResponse` protocol and the substitution occurs as in macro `->>` (the `thread-last` macro).
(as-error data)
(as-error type data)
(as-error type data meta)
Returns instance of unifier.response/UnifiedError
.
Examples:
with default error type
(as-error "a user was not found")
with specified error type
(as-error :user/not-found "a user was not found")
with specified error type
and meta
(as-error :user/not-found "john@doe.com" {:i18n/key :user/not-found})
Returns instance of `unifier.response/UnifiedError`. Examples: * with default error `type` (as-error "a user was not found") * with specified error `type` (as-error :user/not-found "a user was not found") * with specified error `type` and `meta` (as-error :user/not-found "john@doe.com" {:i18n/key :user/not-found})
A dispatcher for the unified responses.
A dispatcher for the unified responses.
(as-success data)
(as-success type data)
(as-success type data meta)
Returns instance of unifier.response/UnifiedSuccess
.
Examples:
with default success type
(as-success "a user was created successfully")
with specified success type
(as-success :user/created "a user was created successfully")
with specified success type
and meta
(as-success :user/created "a user was created successfully" {:i18n/key :user/created})
Returns instance of `unifier.response/UnifiedSuccess`. Examples: * with default success `type` (as-success "a user was created successfully") * with specified success `type` (as-success :user/created "a user was created successfully") * with specified success `type` and `meta` (as-success :user/created "a user was created successfully" {:i18n/key :user/created})
(error? x)
Returns true
if the given value is instance of unifier.response/UnifiedError
. Otherwise false
.
Returns `true` if the given value is instance of `unifier.response/UnifiedError`. Otherwise `false`.
(-get-meta _)
Returns meta
of response.
Returns `meta` of response.
(-error? _)
Returns true
if the given value is instance of unifier.response/UnifiedError
. Otherwise false
.
Returns `true` if the given value is instance of `unifier.response/UnifiedError`. Otherwise `false`.
(-success? _)
Returns true
if the given value is instance of unifier.response/UnifiedSuccess
. Otherwise false
.
Returns `true` if the given value is instance of `unifier.response/UnifiedSuccess`. Otherwise `false`.
(-get-type _)
Returns type
of response.
Returns `type` of response.
(-response? _)
Returns true
if the given value is implements unifier.response/IUnifiedResponse
protocol. Otherwise false
.
Returns `true` if the given value is implements `unifier.response/IUnifiedResponse` protocol. Otherwise `false`.
(-get-data _)
Returns data
of response.
Returns `data` of response.
(response? x)
Returns true
if the given value is implements unifier.response/IUnifiedResponse
protocol. Otherwise false
.
Returns `true` if the given value is implements `unifier.response/IUnifiedResponse` protocol. Otherwise `false`.
(set-default-error-type! type)
Overrides default error type
.
Overrides default error `type`.
(set-default-success-type! type)
Overrides default success type
.
Overrides default success `type`.
(success? x)
Returns true
if the given value is instance of unifier.response/UnifiedSuccess
. Otherwise false
.
Returns `true` if the given value is instance of `unifier.response/UnifiedSuccess`. Otherwise `false`.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close