View Source parthenon_decode (parthenon v0.9.0)

Link to this section Summary

Link to this section Types

-type array() :: [value()].
-type decode_options() :: #decode_options{}.
-type key_format() :: existing_atom | atom | binary.
-type key_type() :: binary() | atom().
-type next() ::
    {object, Key :: binary(), object(), schema(), decode_options()} |
    {list, array(), schema(), decode_options()}.
-type object() :: #{key_type() => value()} | [{key_type(), value()}] | {[{key_type(), value()}]}.
-type object_format() :: maps | proplists | tuple.
-type option() ::
    {object_format, object_format()} |
    {key_format, key_format()} |
    {schema_options, [{null_as, atom() | binary()}]}.
-type schema() :: parthenon_schema:schema().
-type schema_options() :: #schema_options{}.
API
-type value() :: undefined | integer() | float() | binary() | boolean() | array() | object().
-type whitespace_next() ::
    {object_key, object(), schema(), decode_options()} |
    {object_value, Key :: binary(), object(), schema(), decode_options()} |
    {list, array(), schema(), decode_options()}.

Link to this section Functions

Link to this function

try_decode(SchemaName, Binary)

View Source
-spec try_decode(SchemaName :: atom(), Binary :: binary()) -> {ok, value()} | {error, term()}.
Link to this function

try_decode(SchemaName, Binary, Options)

View Source
-spec try_decode(SchemaName :: atom(), Binary :: binary(), Options :: [option()]) ->
              {ok, value()} | {error, term()}.