View Source argo_term_value_decoder behaviour (argo v1.1.0)
Summary
Types
-type error_reason() :: invalid | type_mismatch | dynamic().
-type options() :: dynamic().
-type result(Ok, Error) :: {ok, Ok} | {error, Error}.
-type state() :: dynamic().
-type t() :: #argo_term_value_decoder{decoder_module :: module(), decoder_state :: argo_term_value_decoder:state()}.
Callbacks
-callback decode_array(DecoderState, ArrayWireTypeHint, TermValue) -> {DecoderState, Result} when DecoderState :: state(), ArrayWireTypeHint :: argo_term:array_wire_type_hint(), TermValue :: argo_term:term_value(), Result :: result(ArrayTermValue, ErrorReason), ArrayTermValue :: argo_term:term_value(), ErrorReason :: error_reason().
Link to this callback
decode_array_next(DecoderState, Index, ArrayWireTypeHint, ArrayTermValue)
View Source-callback decode_array_next(DecoderState, Index, ArrayWireTypeHint, ArrayTermValue) -> {DecoderState, Result} when DecoderState :: state(), Index :: argo_types:index(), ArrayWireTypeHint :: argo_term:array_wire_type_hint(), ArrayTermValue :: argo_term:term_value(), Result :: result({ArrayTermValue, OptionItemTermValue}, ErrorReason), OptionItemTermValue :: argo_types:option(ItemTermValue), ItemTermValue :: argo_term:term_value(), ErrorReason :: error_reason().
-callback decode_array_stop(DecoderState, ArrayTermValue, ArrayValue) -> {DecoderState, Result} when DecoderState :: state(), ArrayTermValue :: argo_term:term_value(), ArrayValue :: argo_array_value:t(), Result :: result(ArrayValue, ErrorReason), ErrorReason :: error_reason().
-callback decode_block(DecoderState, BlockWireTypeHint, TermValue) -> {DecoderState, Result} when DecoderState :: state(), BlockWireTypeHint :: argo_term:block_wire_type_hint(), TermValue :: argo_term:term_value(), Result :: result(BlockTermValue, ErrorReason), BlockTermValue :: argo_term:term_value(), ErrorReason :: error_reason().
-callback decode_block_stop(DecoderState, BlockValue) -> {DecoderState, Result} when DecoderState :: state(), BlockValue :: argo_block_value:t(), Result :: result(DecoderState, ErrorReason), ErrorReason :: error_reason().
-callback decode_desc(DecoderState, TermValue) -> {DecoderState, Result} when DecoderState :: state(), TermValue :: argo_term:term_value(), Result :: result({DescTermValue, DescValueHint}, ErrorReason), DescTermValue :: argo_term:term_value(), DescValueHint :: argo_term:desc_value_hint(), ErrorReason :: error_reason().
-callback decode_desc_list_next(DecoderState, Index, DescListTermValue) -> {DecoderState, Result} when DecoderState :: state(), Index :: argo_types:index(), DescListTermValue :: argo_term:term_value(), Result :: result({DescListTermValue, OptionItemTermValue}, ErrorReason), OptionItemTermValue :: argo_types:option(ItemTermValue), ItemTermValue :: argo_term:term_value(), ErrorReason :: error_reason().
-callback decode_desc_list_stop(DecoderState, DescListTermValue, DescValue) -> {DecoderState, Result} when DecoderState :: state(), DescListTermValue :: argo_term:term_value(), DescValue :: argo_desc_value:t(), Result :: result(DescValue, ErrorReason), ErrorReason :: error_reason().
-callback decode_desc_object_next(DecoderState, Index, DescObjectTermValue) -> {DecoderState, Result} when DecoderState :: state(), Index :: argo_types:index(), DescObjectTermValue :: argo_term:term_value(), Result :: result({DescObjectTermValue, OptionEntry}, ErrorReason), OptionEntry :: argo_types:option({ObjectKey, ObjectTermValue}), ObjectKey :: unicode:unicode_binary(), ObjectTermValue :: argo_term:term_value(), ErrorReason :: error_reason().
Link to this callback
decode_desc_object_stop(DecoderState, DescObjectTermValue, DescValue)
View Source-callback decode_desc_object_stop(DecoderState, DescObjectTermValue, DescValue) -> {DecoderState, Result} when DecoderState :: state(), DescObjectTermValue :: argo_term:term_value(), DescValue :: argo_desc_value:t(), Result :: result(DescValue, ErrorReason), ErrorReason :: error_reason().
Link to this callback
decode_desc_scalar(DecoderState, DescValueScalarHint, DescScalarTermValue)
View Source-callback decode_desc_scalar(DecoderState, DescValueScalarHint, DescScalarTermValue) -> {DecoderState, Result} when DecoderState :: state(), DescValueScalarHint :: argo_term:desc_value_scalar_hint(), DescScalarTermValue :: argo_term:term_value(), Result :: result({DescScalarTermValue, DescScalar}, ErrorReason), DescScalar :: argo_desc_value:inner_scalar(), ErrorReason :: error_reason().
Link to this callback
decode_desc_scalar_stop(DecoderState, DescScalarTermValue, DescValue)
View Source-callback decode_desc_scalar_stop(DecoderState, DescScalarTermValue, DescValue) -> {DecoderState, Result} when DecoderState :: state(), DescScalarTermValue :: argo_term:term_value(), DescValue :: argo_desc_value:t(), Result :: result(DescValue, ErrorReason), ErrorReason :: error_reason().
-callback decode_error(DecoderState, TermValue) -> {DecoderState, Result} when DecoderState :: state(), TermValue :: argo_term:term_value(), Result :: result(ErrorTermValue, ErrorReason), ErrorTermValue :: argo_term:term_value(), ErrorReason :: error_reason().
-callback decode_error_extensions(DecoderState, ErrorTermValue) -> {DecoderState, Result} when DecoderState :: state(), ErrorTermValue :: argo_term:term_value(), Result :: result({ErrorTermValue, OptionExtensionsTermValue}, ErrorReason), OptionExtensionsTermValue :: argo_types:option(ExtensionsTermValue), ExtensionsTermValue :: argo_term:term_value(), ErrorReason :: error_reason().
-callback decode_error_locations(DecoderState, ErrorTermValue) -> {DecoderState, Result} when DecoderState :: state(), ErrorTermValue :: argo_term:term_value(), Result :: result({ErrorTermValue, OptionLocationsTermValue}, ErrorReason), OptionLocationsTermValue :: argo_types:option(LocationsTermValue), LocationsTermValue :: argo_term:term_value(), ErrorReason :: error_reason().
-callback decode_error_message(DecoderState, ErrorTermValue) -> {DecoderState, Result} when DecoderState :: state(), ErrorTermValue :: argo_term:term_value(), Result :: result({ErrorTermValue, OptionMessageTermValue}, ErrorReason), OptionMessageTermValue :: argo_types:option(MessageTermValue), MessageTermValue :: argo_term:term_value(), ErrorReason :: error_reason().
-callback decode_error_path(DecoderState, ErrorTermValue) -> {DecoderState, Result} when DecoderState :: state(), ErrorTermValue :: argo_term:term_value(), Result :: result({ErrorTermValue, OptionPathTermValue}, ErrorReason), OptionPathTermValue :: argo_types:option(PathTermValue), PathTermValue :: argo_term:term_value(), ErrorReason :: error_reason().
-callback decode_error_stop(DecoderState, ErrorTermValue, ErrorValue) -> {DecoderState, Result} when DecoderState :: state(), ErrorTermValue :: argo_term:term_value(), ErrorValue :: argo_error_value:t(), Result :: result(ErrorValue, ErrorReason), ErrorReason :: error_reason().
-callback decode_extensions(DecoderState, TermValue) -> {DecoderState, Result} when DecoderState :: state(), TermValue :: argo_term:term_value(), Result :: result(ExtensionsTermValue, ErrorReason), ExtensionsTermValue :: argo_term:term_value(), ErrorReason :: error_reason().
-callback decode_extensions_next(DecoderState, Index, ExtensionsTermValue) -> {DecoderState, Result} when DecoderState :: state(), Index :: argo_types:index(), ExtensionsTermValue :: argo_term:term_value(), Result :: result({ExtensionsTermValue, OptionEntry}, ErrorReason), OptionEntry :: argo_types:option({ObjectKey, ObjectTermValue}), ObjectKey :: unicode:unicode_binary(), ObjectTermValue :: argo_term:term_value(), ErrorReason :: error_reason().
Link to this callback
decode_extensions_stop(DecoderState, ExtensionsTermValue, ExtensionsValue)
View Source-callback decode_extensions_stop(DecoderState, ExtensionsTermValue, ExtensionsValue) -> {DecoderState, Result} when DecoderState :: state(), ExtensionsTermValue :: argo_term:term_value(), ExtensionsValue :: argo_extensions_value:t(), Result :: result(ExtensionsValue, ErrorReason), ErrorReason :: error_reason().
-callback decode_location(DecoderState, LocationTermValue) -> {DecoderState, Result} when DecoderState :: state(), LocationTermValue :: argo_term:term_value(), Result :: result(LocationTermValue, ErrorReason), ErrorReason :: error_reason().
-callback decode_location_column(DecoderState, LocationTermValue) -> {DecoderState, Result} when DecoderState :: state(), LocationTermValue :: argo_term:term_value(), Result :: result({LocationTermValue, OptionColumnTermValue}, ErrorReason), OptionColumnTermValue :: argo_types:option(ColumnTermValue), ColumnTermValue :: argo_term:term_value(), ErrorReason :: error_reason().
-callback decode_location_line(DecoderState, LocationTermValue) -> {DecoderState, Result} when DecoderState :: state(), LocationTermValue :: argo_term:term_value(), Result :: result({LocationTermValue, OptionLineTermValue}, ErrorReason), OptionLineTermValue :: argo_types:option(LineTermValue), LineTermValue :: argo_term:term_value(), ErrorReason :: error_reason().
Link to this callback
decode_location_stop(DecoderState, LocationTermValue, LocationValue)
View Source-callback decode_location_stop(DecoderState, LocationTermValue, LocationValue) -> {DecoderState, Result} when DecoderState :: state(), LocationTermValue :: argo_term:term_value(), LocationValue :: argo_location_value:t(), Result :: result(LocationValue, ErrorReason), ErrorReason :: error_reason().
-callback decode_locations(DecoderState, LocationsTermValue) -> {DecoderState, Result} when DecoderState :: state(), LocationsTermValue :: argo_term:term_value(), Result :: result(LocationsTermValue, ErrorReason), ErrorReason :: error_reason().
-callback decode_locations_next(DecoderState, Index, LocationsTermValue) -> {DecoderState, Result} when DecoderState :: state(), Index :: argo_types:index(), LocationsTermValue :: argo_term:term_value(), Result :: result({LocationsTermValue, OptionLocationTermValue}, ErrorReason), OptionLocationTermValue :: argo_types:option(LocationTermValue), LocationTermValue :: argo_term:term_value(), ErrorReason :: error_reason().
Link to this callback
decode_locations_stop(DecoderState, LocationsTermValue, LocationValueList)
View Source-callback decode_locations_stop(DecoderState, LocationsTermValue, LocationValueList) -> {DecoderState, Result} when DecoderState :: state(), LocationsTermValue :: argo_term:term_value(), LocationValueList :: [LocationValue], LocationValue :: argo_location_value:t(), Result :: result(LocationValueList, ErrorReason), ErrorReason :: error_reason().
-callback decode_nullable(DecoderState, NullableWireTypeHint, TermValue) -> {DecoderState, Result} when DecoderState :: state(), NullableWireTypeHint :: argo_term:nullable_wire_type_hint(), TermValue :: argo_term:term_value(), Result :: result(NullableTermValue, ErrorReason), NullableTermValue :: null | {non_null, NonNullTermValue} | {field_errors, FieldErrorsTermValue}, NonNullTermValue :: argo_term:term_value(), FieldErrorsTermValue :: argo_term:term_value(), ErrorReason :: error_reason().
Link to this callback
decode_nullable_field_errors(DecoderState, NullableWireTypeHint, FieldErrorsTermValue)
View Source-callback decode_nullable_field_errors(DecoderState, NullableWireTypeHint, FieldErrorsTermValue) -> {DecoderState, Result} when DecoderState :: state(), NullableWireTypeHint :: argo_term:nullable_wire_type_hint(), FieldErrorsTermValue :: argo_term:term_value(), Result :: result(FieldErrorsTermValue, ErrorReason), ErrorReason :: error_reason().
Link to this callback
decode_nullable_field_errors_next(DecoderState, Index, NullableWireTypeHint, FieldErrorsTermValue)
View Source-callback decode_nullable_field_errors_next(DecoderState, Index, NullableWireTypeHint, FieldErrorsTermValue) -> {DecoderState, Result} when DecoderState :: state(), Index :: argo_types:index(), NullableWireTypeHint :: argo_term:nullable_wire_type_hint(), FieldErrorsTermValue :: argo_term:term_value(), Result :: result({FieldErrorsTermValue, OptionFieldErrorTermValue}, ErrorReason), OptionFieldErrorTermValue :: argo_types:option(FieldErrorTermValue), FieldErrorTermValue :: argo_term:term_value(), ErrorReason :: error_reason().
Link to this callback
decode_nullable_field_errors_stop(DecoderState, FieldErrorsTermValue, FieldErrorsValue)
View Source-callback decode_nullable_field_errors_stop(DecoderState, FieldErrorsTermValue, FieldErrorsValue) -> {DecoderState, Result} when DecoderState :: state(), FieldErrorsTermValue :: argo_term:term_value(), FieldErrorsValue :: [FieldErrorValue], FieldErrorValue :: argo_error_value:t(), Result :: result(FieldErrorsValue, ErrorReason), ErrorReason :: error_reason().
-callback decode_nullable_stop(DecoderState, NullableValue) -> {DecoderState, Result} when DecoderState :: state(), NullableValue :: argo_nullable_value:t(), Result :: result(NullableValue, ErrorReason), ErrorReason :: error_reason().
-callback decode_path(DecoderState, TermValue) -> {DecoderState, Result} when DecoderState :: state(), TermValue :: argo_term:term_value(), Result :: result(PathTermValue, ErrorReason), PathTermValue :: argo_term:term_value(), ErrorReason :: error_reason().
-callback decode_path_next(DecoderState, Index, PathTermValue) -> {DecoderState, Result} when DecoderState :: state(), Index :: argo_types:index(), PathTermValue :: argo_term:term_value(), Result :: result({PathTermValue, OptionSegment}, ErrorReason), OptionSegment :: argo_types:option(FieldName | ListIndex), FieldName :: argo_types:name(), ListIndex :: argo_types:index(), ErrorReason :: error_reason().
-callback decode_path_stop(DecoderState, PathTermValue, PathValue) -> {DecoderState, Result} when DecoderState :: state(), PathTermValue :: argo_term:term_value(), PathValue :: argo_path_value:t(), Result :: result(PathValue, ErrorReason), ErrorReason :: error_reason().
-callback decode_record(DecoderState, RecordWireTypeHint, TermValue) -> {DecoderState, Result} when DecoderState :: state(), RecordWireTypeHint :: argo_term:record_wire_type_hint(), TermValue :: argo_term:term_value(), Result :: result(RecordTermValue, ErrorReason), RecordTermValue :: argo_term:term_value(), ErrorReason :: error_reason().
Link to this callback
decode_record_next(DecoderState, Index, FieldWireTypeHint, RecordTermValue)
View Source-callback decode_record_next(DecoderState, Index, FieldWireTypeHint, RecordTermValue) -> {DecoderState, Result} when DecoderState :: state(), FieldWireTypeHint :: argo_term:field_wire_type_hint(), Index :: argo_types:index(), RecordTermValue :: argo_term:term_value(), Result :: result({RecordTermValue, OptionFieldTermValue}, ErrorReason), OptionFieldTermValue :: argo_types:option(FieldTermValue), FieldTermValue :: argo_term:term_value(), ErrorReason :: error_reason().
-callback decode_record_stop(DecoderState, RecordTermValue, RecordValue) -> {DecoderState, Result} when DecoderState :: state(), RecordTermValue :: argo_term:term_value(), RecordValue :: argo_record_value:t(), Result :: result(RecordValue, ErrorReason), ErrorReason :: error_reason().
-callback decode_scalar(DecoderState, ScalarWireTypeHint, TermValue) -> {DecoderState, Result} when DecoderState :: state(), ScalarWireTypeHint :: argo_term:scalar_wire_type_hint(), TermValue :: argo_term:term_value(), Result :: result(Scalar, ErrorReason), Scalar :: boolean() | binary() | DescTermValue | float() | unicode:unicode_binary() | argo_types:i64(), DescTermValue :: argo_term:term_value(), ErrorReason :: error_reason().
-callback decode_scalar_stop(DecoderState, ScalarValue) -> {DecoderState, Result} when DecoderState :: state(), ScalarValue :: argo_scalar_value:t(), Result :: result(ScalarValue, ErrorReason), ErrorReason :: error_reason().
Functions
Link to this function
decode_array_wire_type(TermValueDecoder, ArrayWireType, TermValue)
View Source-spec decode_array_wire_type(TermValueDecoder, ArrayWireType, TermValue) -> {TermValueDecoder, ArrayValue} when TermValueDecoder :: t(), ArrayWireType :: argo_array_wire_type:t(), TermValue :: argo_term:term_value(), ArrayValue :: argo_array_value:t().
Link to this function
decode_block_wire_type(TermValueDecoder, BlockWireType, TermValue)
View Source-spec decode_block_wire_type(TermValueDecoder, BlockWireType, TermValue) -> {TermValueDecoder, BlockValue} when TermValueDecoder :: t(), BlockWireType :: argo_block_wire_type:t(), TermValue :: argo_term:term_value(), BlockValue :: argo_block_value:t().
-spec decode_desc_wire_type(TermValueDecoder, TermValue) -> {TermValueDecoder, DescValue} when TermValueDecoder :: t(), TermValue :: argo_term:term_value(), DescValue :: argo_desc_value:t().
-spec decode_error_wire_type(TermValueDecoder, TermValue) -> {TermValueDecoder, ErrorValue} when TermValueDecoder :: t(), TermValue :: argo_term:term_value(), ErrorValue :: argo_error_value:t().
-spec decode_extensions_wire_type(TermValueDecoder, TermValue) -> {TermValueDecoder, ExtensionsValue} when TermValueDecoder :: t(), TermValue :: argo_term:term_value(), ExtensionsValue :: argo_extensions_value:t().
Link to this function
decode_field_wire_type(TermValueDecoder, FieldWireType, OptionTermValue)
View Source-spec decode_field_wire_type(TermValueDecoder, FieldWireType, OptionTermValue) -> {TermValueDecoder, FieldValue} when TermValueDecoder :: t(), FieldWireType :: argo_field_wire_type:t(), OptionTermValue :: argo_types:option(TermValue), TermValue :: argo_term:term_value(), FieldValue :: argo_field_value:t().
-spec decode_location_wire_type(TermValueDecoder, TermValue) -> {TermValueDecoder, LocationValue} when TermValueDecoder :: t(), TermValue :: argo_term:term_value(), LocationValue :: argo_location_value:t().
Link to this function
decode_nullable_wire_type(TermValueDecoder, NullableWireType, TermValue)
View Source-spec decode_nullable_wire_type(TermValueDecoder, NullableWireType, TermValue) -> {TermValueDecoder, NullableValue} when TermValueDecoder :: t(), NullableWireType :: argo_nullable_wire_type:t(), TermValue :: argo_term:term_value(), NullableValue :: argo_nullable_value:t().
-spec decode_path_wire_type(TermValueDecoder, TermValue) -> {TermValueDecoder, PathValue} when TermValueDecoder :: t(), TermValue :: argo_term:term_value(), PathValue :: argo_path_value:t().
Link to this function
decode_record_wire_type(TermValueDecoder, RecordWireType, TermValue)
View Source-spec decode_record_wire_type(TermValueDecoder, RecordWireType, TermValue) -> {TermValueDecoder, RecordValue} when TermValueDecoder :: t(), RecordWireType :: argo_record_wire_type:t(), TermValue :: argo_term:term_value(), RecordValue :: argo_record_value:t().
Link to this function
decode_scalar_wire_type(TermValueDecoder, ScalarWireType, TermValue)
View Source-spec decode_scalar_wire_type(TermValueDecoder, ScalarWireType, TermValue) -> {TermValueDecoder, ScalarValue} when TermValueDecoder :: t(), ScalarWireType :: argo_scalar_wire_type:t(), TermValue :: argo_term:term_value(), ScalarValue :: argo_scalar_value:t().
-spec decode_wire_type(TermValueDecoder, WireType, TermValue) -> {TermValueDecoder, Value} when TermValueDecoder :: t(), WireType :: argo_wire_type:t(), TermValue :: argo_term:term_value(), Value :: argo_value:t().