Liking cljdoc? Tell your friends :D

immutant.codecs

Common codecs used when [de]serializing data structures.

The default registered codecs are:

  • :edn - encodes to/decodes from an EDN string
  • :json - encodes to/decodes from a JSON string. Requires cheshire as a dependency.
  • :none - performs no encoding

You can enable :fressian encoding by calling immutant.codecs.fressian/register-fressian-codec, or make custom codecs with make-codec.

Common codecs used when [de]serializing data structures.

The default registered codecs are:

* :edn - encodes to/decodes from an EDN string
* :json - encodes to/decodes from a JSON string. Requires `cheshire` as a
  dependency.
* :none - performs no encoding

You can enable :fressian encoding by calling
[[immutant.codecs.fressian/register-fressian-codec]], or make custom
codecs with [[make-codec]].
raw docstring

codec-setclj

(codec-set)

Returns a set of names for available codecs.

Returns a set of names for available codecs.
sourceraw docstring

decodeclj

(decode data)
(decode data encoding)

Decodes data using the codec for encoding.

encoding can be the name of the encoding or its content-type. encoding defaults to :edn.

Decodes `data` using the codec for `encoding`.

`encoding` can be the name of the encoding or its
content-type. `encoding` defaults to :edn.
sourceraw docstring

encodeclj

(encode data)
(encode data encoding)

Encodes data using the codec for encoding.

encoding can be the name of the encoding or its content-type. encoding defaults to :edn.

Encodes `data` using the codec for `encoding`.

`encoding` can be the name of the encoding or its
content-type. `encoding` defaults to :edn.
sourceraw docstring

make-codeccljmacro

(make-codec & settings)

Creates a codec instance for the given settings.

settings can be a map or kwargs, with these keys, most of which are required:

  • :name - The nickname for the codec. Can be a String or Keyword.
  • :content-type - The content type for the codec as a String.
  • :type - The type of data the codec encodes to/decodes from. Can be either :bytes or :string, and is optional, defaulting to :string.
  • :encode - A single-arity function that encodes its argument to the expected type.
  • :decode - A single-arity function that decodes its argument from the expected type to clojure data.
Creates a codec instance for the given settings.

`settings` can be a map or kwargs, with these keys, most of which are
required:

* :name - The nickname for the codec. Can be a String or Keyword.
* :content-type - The content type for the codec as a String.
* :type - The type of data the codec encodes to/decodes from.
  Can be either :bytes or :string, and is optional, defaulting to
  :string.
* :encode - A single-arity function that encodes its argument to
  the expected type.
* :decode - A single-arity function that decodes its argument from
  the expected type to clojure data.
sourceraw docstring

register-codecclj

(register-codec codec)

Registers a codec for use.

codec should be the result of make-codec.

Registers a codec for use.

`codec` should be the result of [[make-codec]].
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close