Liking cljdoc? Tell your friends :D

io.randomseed.bankster.serializers.edn

Bankster library, EDN-oriented serialization helpers.

Bankster library, EDN-oriented serialization helpers.
raw docstring

currency->edn-full-mapclj

(currency->edn-full-map c)
(currency->edn-full-map c opts)

Converts Currency to a full EDN-friendly map with all fields.

Full shape:

  • :id - currency identifier keyword (may be namespaced)
  • :numeric - ISO numeric code (or -1 if absent)
  • :scale - decimal places (or -1 for auto-scaled)
  • :domain - domain keyword (e.g. :ISO-4217, :CRYPTO)
  • :kind - kind keyword (e.g. :FIAT, :DECENTRALIZED)

Options:

  • :code-only? - when truthy, namespace is omitted in :id
  • :keys - vector of keys to include (filters output)
Converts Currency to a full EDN-friendly map with all fields.

Full shape:
- `:id`      - currency identifier keyword (may be namespaced)
- `:numeric` - ISO numeric code (or -1 if absent)
- `:scale`   - decimal places (or -1 for auto-scaled)
- `:domain`  - domain keyword (e.g. `:ISO-4217`, `:CRYPTO`)
- `:kind`    - kind keyword (e.g. `:FIAT`, `:DECENTRALIZED`)

Options:
- `:code-only?` - when truthy, namespace is omitted in `:id`
- `:keys`       - vector of keys to include (filters output)
sourceraw docstring

currency->edn-keywordclj

(currency->edn-keyword c)
(currency->edn-keyword c opts)

Converts Currency to an EDN keyword identifier.

Options:

  • :code-only? - when truthy, namespace is omitted: :crypto/ETH:ETH
Converts Currency to an EDN keyword identifier.

Options:
- `:code-only?` - when truthy, namespace is omitted: `:crypto/ETH` → `:ETH`
sourceraw docstring

currency->edn-mapclj

(currency->edn-map c)
(currency->edn-map c opts)

Converts Currency to a minimal EDN-friendly map.

Minimal shape (by default):

  • :id - currency identifier keyword

When :full? is truthy, delegates to currency->edn-full-map.

Options:

  • :code-only? - when truthy, namespace is omitted in :id
  • :full? - when truthy, returns full map via currency->edn-full-map
  • :keys - (only with :full?) vector of keys to include
Converts Currency to a minimal EDN-friendly map.

Minimal shape (by default):
- `:id` - currency identifier keyword

When `:full?` is truthy, delegates to `currency->edn-full-map`.

Options:
- `:code-only?` - when truthy, namespace is omitted in `:id`
- `:full?`      - when truthy, returns full map via `currency->edn-full-map`
- `:keys`       - (only with `:full?`) vector of keys to include
sourceraw docstring

currency->edn-stringclj

(currency->edn-string c)
(currency->edn-string c opts)

Converts Currency to an EDN tagged literal string.

Format: #currency <keyword> (e.g. #currency :PLN or #currency :crypto/ETH)

Options:

  • :code-only? - when truthy, namespace is omitted: :crypto/ETH:ETH
Converts Currency to an EDN tagged literal string.

Format: `#currency <keyword>` (e.g. `#currency :PLN` or `#currency :crypto/ETH`)

Options:
- `:code-only?` - when truthy, namespace is omitted: `:crypto/ETH` → `:ETH`
sourceraw docstring

edn-keyword->currencyclj

(edn-keyword->currency k)
(edn-keyword->currency k opts)

Builds Currency from an EDN keyword identifier.

Options:

  • :registry - registry to use for lookup (default: registry/get)
Builds Currency from an EDN keyword identifier.

Options:
- `:registry` - registry to use for lookup (default: `registry/get`)
sourceraw docstring

edn-map->currencyclj

(edn-map->currency m)
(edn-map->currency m opts)

Builds Currency from an EDN map.

Uses :id for lookup.

Options:

  • :registry - registry to use for lookup (default: registry/get)
Builds Currency from an EDN map.

Uses `:id` for lookup.

Options:
- `:registry` - registry to use for lookup (default: `registry/get`)
sourceraw docstring

edn-map->moneyclj

(edn-map->money m)
(edn-map->money m opts)

Builds Money from an EDN map.

Options:

  • :registry - registry to use for currency lookup (default: registry/get)
  • :rounding-mode - rounding mode for rescaling (RoundingMode, keyword, or string)
  • :rescale - integer scale to use instead of currency's nominal scale. When provided, the Currency is cloned with this scale before creating Money. This prevents data loss when the registry currency has a smaller scale than the incoming data.
Builds Money from an EDN map.

Options:
- `:registry`      - registry to use for currency lookup (default: `registry/get`)
- `:rounding-mode` - rounding mode for rescaling (RoundingMode, keyword, or string)
- `:rescale`       - integer scale to use instead of currency's nominal scale.
                     When provided, the Currency is cloned with this scale before
                     creating Money. This prevents data loss when the registry
                     currency has a smaller scale than the incoming data.
sourceraw docstring

edn-string->currencyclj

(edn-string->currency s)
(edn-string->currency s opts)

Builds Currency from an EDN tagged literal string.

Options:

  • :registry - registry to use for lookup (default: registry/get)
Builds Currency from an EDN tagged literal string.

Options:
- `:registry` - registry to use for lookup (default: `registry/get`)
sourceraw docstring

edn-string->moneyclj

(edn-string->money s)
(edn-string->money s opts)

Builds Money from an EDN tagged literal string.

Accepts:

  • #money[12.30M PLN]
  • #money/crypto[1.5M ETH]
  • #money{:currency :PLN :amount 12.30M}

Options:

  • :registry - registry to use for currency lookup (default: registry/get)
  • :rounding-mode - rounding mode for rescaling (RoundingMode, keyword, or string)
  • :rescale - integer scale to use instead of currency's nominal scale
Builds Money from an EDN tagged literal string.

Accepts:
- `#money[12.30M PLN]`
- `#money/crypto[1.5M ETH]`
- `#money{:currency :PLN :amount 12.30M}`

Options:
- `:registry`      - registry to use for currency lookup (default: `registry/get`)
- `:rounding-mode` - rounding mode for rescaling (RoundingMode, keyword, or string)
- `:rescale`       - integer scale to use instead of currency's nominal scale
sourceraw docstring

EdnDeserializablecljprotocol

Protocol for EDN deserialization of Bankster types.

Options map supports:

  • :registry - registry to use for currency lookup (default: registry/get)
  • :rounding-mode - rounding mode for rescaling (RoundingMode, keyword, or string)
  • :rescale - integer scale to use instead of currency's nominal scale. When provided, the Currency object is cloned with this scale before creating Money. This prevents data loss when the registry currency has a smaller scale than the incoming data.
Protocol for EDN deserialization of Bankster types.

Options map supports:
- `:registry`       - registry to use for currency lookup (default: `registry/get`)
- `:rounding-mode`  - rounding mode for rescaling (RoundingMode, keyword, or string)
- `:rescale`        - integer scale to use instead of currency's nominal scale.
                      When provided, the Currency object is cloned with this scale
                      before creating Money. This prevents data loss when the registry
                      currency has a smaller scale than the incoming data.

from-edn-mapclj

(from-edn-map type-token m)
(from-edn-map type-token m opts)

Deserializes a value from an EDN map.

Deserializes a value from an EDN map.

from-edn-stringclj

(from-edn-string type-token s)
(from-edn-string type-token s opts)

Deserializes a value from an EDN string (tagged literal format).

Deserializes a value from an EDN string (tagged literal format).
sourceraw docstring

EdnSerializablecljprotocol

Protocol for EDN serialization of Bankster types.

Options map supports:

  • :code-only? - when truthy, namespace is omitted: :crypto/ETH:ETH
  • :full? - when truthy, delegates to to-edn-full-map for full serialization
  • :keys - vector of keys to include; supports nested opts via map elements
  • :rescale - integer scale to rescale amounts to (requires :rounding-mode for downscaling)
Protocol for EDN serialization of Bankster types.

Options map supports:
- `:code-only?` - when truthy, namespace is omitted: `:crypto/ETH` → `:ETH`
- `:full?`      - when truthy, delegates to `to-edn-full-map` for full serialization
- `:keys`       - vector of keys to include; supports nested opts via map elements
- `:rescale`    - integer scale to rescale amounts to (requires `:rounding-mode` for downscaling)

to-edn-full-mapclj

(to-edn-full-map this)
(to-edn-full-map this opts)

Serializes the value to a full EDN-friendly map with all available fields. For Currency: {:id, :numeric, :scale, :kind, :domain} For Money: {:currency {...}, :amount} plus any extended fields.

Options:

  • :keys - vector of keys to include; nested opts via map elements e.g. {:keys [:amount {:currency {:keys [:id :numeric]}}]}
Serializes the value to a full EDN-friendly map with all available fields.
For Currency: {:id, :numeric, :scale, :kind, :domain}
For Money: {:currency {...}, :amount} plus any extended fields.

Options:
- `:keys` - vector of keys to include; nested opts via map elements
           e.g. {:keys [:amount {:currency {:keys [:id :numeric]}}]}

to-edn-mapclj

(to-edn-map this)
(to-edn-map this opts)

Serializes the value to a minimal EDN-friendly map. For Money: {:currency :PLN, :amount 12.30M} For Currency: {:id :PLN}

Serializes the value to a minimal EDN-friendly map.
For Money: {:currency :PLN, :amount 12.30M}
For Currency: {:id :PLN}

to-edn-stringclj

(to-edn-string this)
(to-edn-string this opts)

Serializes the value to an EDN string (tagged literal format).

Serializes the value to an EDN string (tagged literal format).
sourceraw docstring

money->edn-full-mapclj

(money->edn-full-map money)
(money->edn-full-map money opts)

Converts Money to a full EDN-friendly map with all fields.

Full shape:

  • :currency - full currency map (via currency->edn-full-map)
  • :amount - BigDecimal amount
  • Plus any extended fields from the Money record

Options:

  • :code-only? - when truthy, namespace is omitted in currency :id
  • :keys - vector of keys to include; supports nested opts for :currency e.g. {:keys [:amount {:currency {:keys [:id :numeric]}}]}
  • :rescale - integer scale to rescale amounts to before serialization
  • :rounding-mode - rounding mode for rescaling (RoundingMode, keyword, or string)
Converts Money to a full EDN-friendly map with all fields.

Full shape:
- `:currency` - full currency map (via `currency->edn-full-map`)
- `:amount`   - BigDecimal amount
- Plus any extended fields from the Money record

Options:
- `:code-only?`    - when truthy, namespace is omitted in currency `:id`
- `:keys`          - vector of keys to include; supports nested opts for `:currency`
                     e.g. {:keys [:amount {:currency {:keys [:id :numeric]}}]}
- `:rescale`       - integer scale to rescale amounts to before serialization
- `:rounding-mode` - rounding mode for rescaling (RoundingMode, keyword, or string)
sourceraw docstring

money->edn-mapclj

(money->edn-map money)
(money->edn-map money opts)

Converts Money to a minimal EDN-friendly map.

Minimal shape:

  • :currency - currency identifier keyword (e.g. :PLN or :crypto/USDT)
  • :amount - BigDecimal amount (scale preserved)

When :full? is truthy, delegates to money->edn-full-map.

Options:

  • :code-only? - when truthy, namespace is omitted: :crypto/ETH:ETH
  • :full? - when truthy, returns full map via money->edn-full-map
  • :keys - (only with :full?) vector of keys to include
  • :rescale - integer scale to rescale amounts to before serialization
  • :rounding-mode - rounding mode for rescaling (RoundingMode, keyword, or string)
Converts Money to a minimal EDN-friendly map.

Minimal shape:
- `:currency` - currency identifier keyword (e.g. `:PLN` or `:crypto/USDT`)
- `:amount`   - BigDecimal amount (scale preserved)

When `:full?` is truthy, delegates to `money->edn-full-map`.

Options:
- `:code-only?`    - when truthy, namespace is omitted: `:crypto/ETH` → `:ETH`
- `:full?`         - when truthy, returns full map via `money->edn-full-map`
- `:keys`          - (only with `:full?`) vector of keys to include
- `:rescale`       - integer scale to rescale amounts to before serialization
- `:rounding-mode` - rounding mode for rescaling (RoundingMode, keyword, or string)
sourceraw docstring

money->edn-stringclj

(money->edn-string money)
(money->edn-string money opts)

Converts Money to an EDN tagged literal string.

Format:

  • ISO currencies: #money[12.30M PLN]
  • Namespaced currencies: #money/crypto[1.5M ETH]

Options:

  • :code-only? - when truthy, always uses #money[...] format without namespace
  • :rescale - integer scale to rescale amounts to before serialization
  • :rounding-mode - rounding mode for rescaling (RoundingMode, keyword, or string)
Converts Money to an EDN tagged literal string.

Format:
- ISO currencies: `#money[12.30M PLN]`
- Namespaced currencies: `#money/crypto[1.5M ETH]`

Options:
- `:code-only?`    - when truthy, always uses `#money[...]` format without namespace
- `:rescale`       - integer scale to rescale amounts to before serialization
- `:rounding-mode` - rounding mode for rescaling (RoundingMode, keyword, or string)
sourceraw docstring

money-codecclj

(money-codec)
(money-codec {:keys [representation code-only? registry rounding-mode]
              :as opts})

Returns a representation-aware codec map for EDN:

  • :encode - (Money -> edn-value) where edn-value is map or string
  • :decode - (edn-value -> Money)
  • :representation - :map or :string

Options:

  • :representation - :map (default) or :string
  • :code-only? - passed to encoder
  • :registry - passed to decoder
  • :rounding-mode - passed to decoder
Returns a representation-aware codec map for EDN:

- `:encode`          - (Money -> edn-value) where edn-value is map or string
- `:decode`          - (edn-value -> Money)
- `:representation`  - `:map` or `:string`

Options:
- `:representation` - `:map` (default) or `:string`
- `:code-only?`     - passed to encoder
- `:registry`       - passed to decoder
- `:rounding-mode`  - passed to decoder
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close