aggregator.utils.common

Common functions, which can be used in several namespaces.

es-special-characters

These are the special characters from elasticsearch and their fitting escaped versions in Clojure. They are used to escape query strings when querying the database.

json->edn

(json->edn payload)

Try to parse payload. Return EDN if payload is json. Else return String as provided by postgres.

return-error

(return-error message)(return-error message data)

Sometimes you want to return an error message. This function packs it into a map.

return-ok

(return-ok message)(return-ok message data)

Return ok and a message.

uuid

(uuid)

Returns a random UUID. Wrapper around java.util.UUID/randomUUID.

valid?

(valid? spec data)

Verify that data conforms to spec. Calls clojure.spec/explain-str to show a useful error message. Prints output to logs and returns a Boolean.