(->kebab-case s)
Converts s
, assumed to be in snake_case, to kebab-case
Converts `s`, assumed to be in snake_case, to kebab-case
(bytes->proto-map mapper clazz bytes)
Deserializes bytes
into a proto-map for the given clazz
Deserializes `bytes` into a proto-map for the given `clazz`
(clj-map->proto-map mapper clazz m)
Translate a map to a proto-map for the supplied class using mapper m
.
The converted map must not violate the class schema, i.e, it must have matching
keyword names as well as value types.
Translate a map to a proto-map for the supplied class using mapper `m`. The converted map must not violate the class schema, i.e, it must have matching keyword names as well as value types.
(defmapper name classes & opts)
Define a new proto mapper for the supplied classes using the supplied options.
Supported options:
:key-name-fn - a function that maps a field name, default identity
:enum-value-fn - a function that maps enum values, default identity
:iter-xf - a transducer for key-value map pairs
:encoders - encoders map, {class->{:from-proto fn, :to-proto fn}}
Define a new proto mapper for the supplied classes using the supplied options. Supported options: :key-name-fn - a function that maps a field name, default `identity` :enum-value-fn - a function that maps enum values, default `identity` :iter-xf - a transducer for key-value map pairs :encoders - encoders map, `{class->{:from-proto fn, :to-proto fn}}`
(dependencies clazz)
Return class dependencies for clazz
.
Return class dependencies for `clazz`.
(p-> x & forms)
Like ->
but meant to be used where the initial expression evaluates to a proto-map. Under the hood, p->
will operate on a transient version of the proto-map and persistent!
it back when done. Expressions will be pipelined as much as possible (but never reordered) such that (p-> person-proto (assoc-in [:pet :name] "patch") (assoc-in [:pet :kind] :cat))
will only generate a single instance of a pet transient map to which both operations will be applied in succession.
Like `->` but meant to be used where the initial expression evaluates to a proto-map. Under the hood, `p->` will operate on a transient version of the proto-map and `persistent!` it back when done. Expressions will be pipelined as much as possible (but never reordered) such that `(p-> person-proto (assoc-in [:pet :name] "patch") (assoc-in [:pet :kind] :cat))` will only generate a single instance of a pet transient map to which both operations will be applied in succession.
(pcond-> expr & clauses)
Equivalent to cond->. See p->
Equivalent to cond->. See `p->`
(proto->proto-map mapper proto)
Wraps a new proto-map around proto
, a POJO.
Wraps a new proto-map around `proto`, a POJO.
(proto-map mapper clazz & kvs)
Returns a new proto-map for the supplied class, via mapper
, initialized
to the optionally supplied key-value pairs.
Returns a new proto-map for the supplied class, via `mapper`, initialized to the optionally supplied key-value pairs.
(proto-map->bytes proto-map)
Serializes proto-map
to protobuf binary
Serializes `proto-map` to protobuf binary
(proto-map->clj-map proto-map)
(proto-map->clj-map proto-map xform)
Recursively converts a proto-map to a regular Clojure map.
Recursively converts a proto-map to a regular Clojure map.
(proto-map->proto m)
Returns the protobuf instance associated with the proto-map
Returns the protobuf instance associated with the proto-map
(remap mapper proto-map)
Remaps proto-map
using mapper
.
The returned proto-map is subject to the configuration of the new mapper.
Remaps `proto-map` using `mapper`. The returned proto-map is subject to the configuration of the new mapper.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close