Pure address query normalisation and hashing — no I/O, no side effects.
Pure address query normalisation and hashing — no I/O, no side effects.
(normalize-query {:keys [address postcode house-number house-number-addition
city country]})Produce a canonical lowercase, trimmed address string from an AddressQuery map.
Fields are joined in a deterministic order: address, postcode, house number (with its addition), city, country. Missing fields are omitted, so a query without a house number hashes as it always did. Country defaults to "Netherlands" when not provided.
Args: query - AddressQuery map with optional :address :postcode :house-number :house-number-addition :city :country
Returns: A non-empty lowercase string suitable for hashing.
Produce a canonical lowercase, trimmed address string from an AddressQuery map.
Fields are joined in a deterministic order: address, postcode, house number
(with its addition), city, country. Missing fields are omitted, so a query
without a house number hashes as it always did. Country defaults to
"Netherlands" when not provided.
Args:
query - AddressQuery map with optional :address :postcode :house-number
:house-number-addition :city :country
Returns:
A non-empty lowercase string suitable for hashing.(query-hash query)(query-hash query providers)Compute a SHA-256 hex digest of the normalised address query.
Used as the primary key in the geo_cache table. With providers, the names a
lookup was restricted to, the key is that restriction's own, so an answer
from a provider left out is never served for it.
Args: query - AddressQuery map providers - optional collection of provider keywords
Returns: 64-character lowercase hex string.
Compute a SHA-256 hex digest of the normalised address query. Used as the primary key in the geo_cache table. With `providers`, the names a lookup was restricted to, the key is that restriction's own, so an answer from a provider left out is never served for it. Args: query - AddressQuery map providers - optional collection of provider keywords Returns: 64-character lowercase hex string.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |