salutem.core.results
Provides constructors and predicates for check results.
healthy
(healthy)
(healthy extra-data)
Constructs a healthy result.
The optional map of extra data is stored with the result for future use. Unless overridden in the extra data map, an :salutem/evaluated-at
field is added to the result, set to the current date time in the system default time zone.
healthy?
(healthy? result)
Returns true
if the result has a :healthy
status, false
otherwise.
outdated?
(outdated? result check)
(outdated? result check relative-to)
Returns true
if the result of the check is outdated, false
otherwise.
For a realtime check, a result is always considered outdated.
For a background check, a result is considered outdated if the time to re-evaluation of the check has passed, i.e., if its evaluation date time is before the current date time minus the check’s time to re-evaluation.
If relative-to
is provided, the calculation is performed relative to that date time rather than to the current date time.
prepend
(prepend result extra-data)
Adds each entry from the provided map of extra data to the result if no entry already exists in the result for the key.
result
(result status)
(result status {:keys [salutem/evaluated-at], :or {evaluated-at (t/now)}, :as extra-data})
Constructs a result with the provided status
.
The optional map of extra data is stored with the result for future use. Unless overridden in the extra data map, an :salutem/evaluated-at
field is added to the result, set to the current date time in the system default time zone.
unhealthy
(unhealthy)
(unhealthy extra-date)
Constructs an unhealthy result.
The optional map of extra data is stored with the result for future use. Unless overridden in the extra data map, an :salutem/evaluated-at
field is added to the result, set to the current date time in the system default time zone.
unhealthy?
(unhealthy? result)
Returns true
if the result has an :unhealthy
status, false
otherwise.