View Source argo_erlang_term_value_encoder (argo v1.1.0)
Summary
Types
-type error_reason() :: dynamic().
-type options() :: #{scalar_encoder_module => module(), scalar_encoder_options => argo_erlang_term_scalar_encoder:options()}.
-type result(Ok, Error) :: argo_term_value_encoder:result(Ok, Error).
-type state() :: #argo_erlang_term_value_encoder{scalar_encoder_module :: module(), scalar_encoder_state :: argo_erlang_term_scalar_encoder:state()}.
Functions
-spec encode_array(EncoderState, ArrayValueHint, ArrayValue) -> {EncoderState, Result} when EncoderState :: state(), ArrayValueHint :: argo_term:array_value_hint(), ArrayValue :: argo_array_value:t(), Result :: result(ArrayTermValue, ErrorReason), ArrayTermValue :: argo_term:term_value(), ErrorReason :: error_reason().
Link to this function
encode_array_next(EncoderState, ArrayValueHint, ItemTermValue, ArrayTermValue)
View Source-spec encode_array_next(EncoderState, ArrayValueHint, ItemTermValue, ArrayTermValue) -> {EncoderState, Result} when EncoderState :: state(), ArrayValueHint :: argo_term:array_value_hint(), ItemTermValue :: argo_term:term_value(), ArrayTermValue :: argo_term:term_value(), Result :: result(ArrayTermValue, ErrorReason), ErrorReason :: error_reason().
-spec encode_array_stop(EncoderState, ArrayValueHint, ArrayTermValue) -> {EncoderState, Result} when EncoderState :: state(), ArrayValueHint :: argo_term:array_value_hint(), ArrayTermValue :: argo_term:term_value(), Result :: result(ArrayTermValue, ErrorReason), ErrorReason :: error_reason().
-spec encode_block(EncoderState, BlockWireTypeHint, ScalarTermValue) -> {EncoderState, Result} when EncoderState :: state(), BlockWireTypeHint :: argo_term:block_wire_type_hint(), ScalarTermValue :: argo_term:term_value(), Result :: result(BlockTermValue, ErrorReason), BlockTermValue :: argo_term:term_value(), ErrorReason :: error_reason().
-spec encode_desc(EncoderState, DescValueHint, DescTermValue) -> {EncoderState, Result} when EncoderState :: state(), DescValueHint :: argo_term:desc_value_hint(), DescTermValue :: argo_term:term_value(), Result :: result(DescTermValue, ErrorReason), ErrorReason :: error_reason().
-spec encode_desc_list(EncoderState, DescList) -> {EncoderState, Result} when EncoderState :: state(), DescList :: argo_desc_value:desc_list(), Result :: result(DescListTermValue, ErrorReason), DescListTermValue :: argo_term:term_value(), ErrorReason :: error_reason().
Link to this function
encode_desc_list_next(EncoderState, DescValueListHint, DescTermValue, DescListTermValue)
View Source-spec encode_desc_list_next(EncoderState, DescValueListHint, DescTermValue, DescListTermValue) -> {EncoderState, Result} when EncoderState :: state(), DescValueListHint :: argo_term:desc_value_list_hint(), DescTermValue :: argo_term:term_value(), DescListTermValue :: argo_term:term_value(), Result :: result(DescListTermValue, ErrorReason), ErrorReason :: error_reason().
-spec encode_desc_list_stop(EncoderState, DescListTermValue) -> {EncoderState, Result} when EncoderState :: state(), DescListTermValue :: argo_term:term_value(), Result :: result(DescListTermValue, ErrorReason), ErrorReason :: error_reason().
-spec encode_desc_object(EncoderState, DescObject) -> {EncoderState, Result} when EncoderState :: state(), DescObject :: argo_desc_value:desc_object(), Result :: result(DescObjectTermValue, ErrorReason), DescObjectTermValue :: argo_term:term_value(), ErrorReason :: error_reason().
Link to this function
encode_desc_object_next(EncoderState, DescValueObjectHint, DescTermValue, DescObjectTermValue)
View Source-spec encode_desc_object_next(EncoderState, DescValueObjectHint, DescTermValue, DescObjectTermValue) -> {EncoderState, Result} when EncoderState :: state(), DescValueObjectHint :: argo_term:desc_value_object_hint(), DescTermValue :: argo_term:term_value(), DescObjectTermValue :: argo_term:term_value(), Result :: result(DescObjectTermValue, ErrorReason), ErrorReason :: error_reason().
-spec encode_desc_object_stop(EncoderState, DescObjectTermValue) -> {EncoderState, Result} when EncoderState :: state(), DescObjectTermValue :: argo_term:term_value(), Result :: result(DescObjectTermValue, ErrorReason), ErrorReason :: error_reason().
-spec encode_desc_scalar(EncoderState, DescScalar) -> {EncoderState, Result} when EncoderState :: state(), DescScalar :: argo_desc_value:inner_scalar(), Result :: result(DescScalarTermValue, ErrorReason), DescScalarTermValue :: argo_term:term_value(), ErrorReason :: error_reason().
-spec encode_error(EncoderState, ErrorValue) -> {EncoderState, Result} when EncoderState :: state(), ErrorValue :: argo_error_value:t(), Result :: result(ErrorTermValue, ErrorReason), ErrorTermValue :: argo_term:term_value(), ErrorReason :: error_reason().
Link to this function
encode_error_extensions(EncoderState, OptionExtensionsTermValue, ErrorTermValue)
View Source-spec encode_error_extensions(EncoderState, OptionExtensionsTermValue, ErrorTermValue) -> {EncoderState, Result} when EncoderState :: state(), OptionExtensionsTermValue :: argo_types:option(ExtensionsTermValue), ExtensionsTermValue :: argo_term:term_value(), ErrorTermValue :: argo_term:term_value(), Result :: result(ErrorTermValue, ErrorReason), ErrorReason :: error_reason().
Link to this function
encode_error_locations(EncoderState, OptionLocationsTermValue, ErrorTermValue)
View Source-spec encode_error_locations(EncoderState, OptionLocationsTermValue, ErrorTermValue) -> {EncoderState, Result} when EncoderState :: state(), OptionLocationsTermValue :: argo_types:option(LocationsTermValue), LocationsTermValue :: argo_term:term_value(), ErrorTermValue :: argo_term:term_value(), Result :: result(ErrorTermValue, ErrorReason), ErrorReason :: error_reason().
-spec encode_error_message(EncoderState, Message, ErrorTermValue) -> {EncoderState, Result} when EncoderState :: state(), Message :: unicode:unicode_binary(), ErrorTermValue :: argo_term:term_value(), Result :: result(ErrorTermValue, ErrorReason), ErrorReason :: error_reason().
Link to this function
encode_error_path(EncoderState, OptionPathTermValue, ErrorTermValue)
View Source-spec encode_error_path(EncoderState, OptionPathTermValue, ErrorTermValue) -> {EncoderState, Result} when EncoderState :: state(), OptionPathTermValue :: argo_types:option(PathTermValue), PathTermValue :: argo_term:term_value(), ErrorTermValue :: argo_term:term_value(), Result :: result(ErrorTermValue, ErrorReason), ErrorReason :: error_reason().
-spec encode_error_stop(EncoderState, ErrorTermValue) -> {EncoderState, Result} when EncoderState :: state(), ErrorTermValue :: argo_term:term_value(), Result :: result(ErrorTermValue, ErrorReason), ErrorReason :: error_reason().
-spec encode_extensions(EncoderState, ExtensionsValue) -> {EncoderState, Result} when EncoderState :: state(), ExtensionsValue :: argo_extensions_value:t(), Result :: result(ExtensionsTermValue, ErrorReason), ExtensionsTermValue :: argo_term:term_value(), ErrorReason :: error_reason().
Link to this function
encode_extensions_next(EncoderState, DescValueObjectHint, DescTermValue, ExtensionsTermValue)
View Source-spec encode_extensions_next(EncoderState, DescValueObjectHint, DescTermValue, ExtensionsTermValue) -> {EncoderState, Result} when EncoderState :: state(), DescValueObjectHint :: argo_term:desc_value_object_hint(), DescTermValue :: argo_term:term_value(), ExtensionsTermValue :: argo_term:term_value(), Result :: result(ExtensionsTermValue, ErrorReason), ErrorReason :: error_reason().
-spec encode_extensions_stop(EncoderState, ExtensionsTermValue) -> {EncoderState, Result} when EncoderState :: state(), ExtensionsTermValue :: argo_term:term_value(), Result :: result(ExtensionsTermValue, ErrorReason), ErrorReason :: error_reason().
-spec encode_field(EncoderState, FieldWireTypeHint, OptionTermValue) -> {EncoderState, Result} when EncoderState :: state(), FieldWireTypeHint :: argo_term:field_wire_type_hint(), OptionTermValue :: argo_types:option(TermValue), TermValue :: argo_term:term_value(), Result :: result(OptionFieldTermValue, ErrorReason), OptionFieldTermValue :: argo_types:option(FieldTermValue), FieldTermValue :: argo_term:term_value(), ErrorReason :: error_reason().
-spec encode_location(EncoderState, LocationValue) -> {EncoderState, Result} when EncoderState :: state(), LocationValue :: argo_location_value:t(), Result :: result(LocationTermValue, ErrorReason), LocationTermValue :: argo_term:term_value(), ErrorReason :: error_reason().
-spec encode_location_column(EncoderState, Column, LocationTermValue) -> {EncoderState, Result} when EncoderState :: state(), Column :: argo_types:varint(), LocationTermValue :: argo_term:term_value(), Result :: result(LocationTermValue, ErrorReason), ErrorReason :: error_reason().
-spec encode_location_line(EncoderState, Line, LocationTermValue) -> {EncoderState, Result} when EncoderState :: state(), Line :: argo_types:varint(), LocationTermValue :: argo_term:term_value(), Result :: result(LocationTermValue, ErrorReason), ErrorReason :: error_reason().
-spec encode_location_stop(EncoderState, LocationTermValue) -> {EncoderState, Result} when EncoderState :: state(), LocationTermValue :: argo_term:term_value(), Result :: result(LocationTermValue, ErrorReason), ErrorReason :: error_reason().
-spec encode_locations(EncoderState, LocationsValue) -> {EncoderState, Result} when EncoderState :: state(), LocationsValue :: [LocationValue], LocationValue :: argo_location_value:t(), Result :: result(LocationsTermValue, ErrorReason), LocationsTermValue :: argo_term:term_value(), ErrorReason :: error_reason().
Link to this function
encode_locations_next(EncoderState, Index, LocationTermValue, LocationsTermValue)
View Source-spec encode_locations_next(EncoderState, Index, LocationTermValue, LocationsTermValue) -> {EncoderState, Result} when EncoderState :: state(), Index :: argo_types:index(), LocationTermValue :: argo_term:term_value(), LocationsTermValue :: argo_term:term_value(), Result :: result(LocationsTermValue, ErrorReason), ErrorReason :: error_reason().
-spec encode_locations_stop(EncoderState, LocationsTermValue) -> {EncoderState, Result} when EncoderState :: state(), LocationsTermValue :: argo_term:term_value(), Result :: result(LocationsTermValue, ErrorReason), ErrorReason :: error_reason().
Link to this function
encode_nullable(EncoderState, NullableWireTypeHint, NullableTermEnum)
View Source-spec encode_nullable(EncoderState, NullableWireTypeHint, NullableTermEnum) -> {EncoderState, Result} when EncoderState :: state(), NullableWireTypeHint :: argo_term:nullable_wire_type_hint(), NullableTermEnum :: null | {non_null, NonNullTermValue} | {field_errors, FieldErrorsTermValue}, NonNullTermValue :: argo_term:term_value(), FieldErrorsTermValue :: argo_term:term_value(), Result :: result(NullableTermValue, ErrorReason), NullableTermValue :: argo_term:term_value(), ErrorReason :: error_reason().
Link to this function
encode_nullable_field_errors(EncoderState, NullableWireTypeHint, NullableValue)
View Source-spec encode_nullable_field_errors(EncoderState, NullableWireTypeHint, NullableValue) -> {EncoderState, Result} when EncoderState :: state(), NullableWireTypeHint :: argo_term:nullable_wire_type_hint(), NullableValue :: argo_nullable_value:t(), Result :: result(FieldErrorsTermValue, ErrorReason), FieldErrorsTermValue :: argo_term:term_value(), ErrorReason :: error_reason().
Link to this function
encode_nullable_field_errors_next(EncoderState, Index, NullableWireTypeHint, ErrorTermValue, FieldErrorsTermValue)
View Source-spec encode_nullable_field_errors_next(EncoderState, Index, NullableWireTypeHint, ErrorTermValue, FieldErrorsTermValue) -> {EncoderState, Result} when EncoderState :: state(), Index :: argo_types:index(), NullableWireTypeHint :: argo_term:nullable_wire_type_hint(), ErrorTermValue :: argo_term:term_value(), FieldErrorsTermValue :: argo_term:term_value(), Result :: result(FieldErrorsTermValue, ErrorReason), ErrorReason :: error_reason().
Link to this function
encode_nullable_field_errors_stop(EncoderState, FieldErrorsTermValue)
View Source-spec encode_nullable_field_errors_stop(EncoderState, FieldErrorsTermValue) -> {EncoderState, Result} when EncoderState :: state(), FieldErrorsTermValue :: argo_term:term_value(), Result :: result(FieldErrorsTermValue, ErrorReason), ErrorReason :: error_reason().
-spec encode_path(EncoderState, PathValue) -> {EncoderState, Result} when EncoderState :: state(), PathValue :: argo_path_value:t(), Result :: result(PathTermValue, ErrorReason), PathTermValue :: argo_term:term_value(), ErrorReason :: error_reason().
-spec encode_path_next(EncoderState, Index, Segment, PathTermValue) -> {EncoderState, Result} when EncoderState :: state(), Index :: argo_types:index(), Segment :: argo_path_value:segment(), PathTermValue :: argo_term:term_value(), Result :: result(PathTermValue, ErrorReason), ErrorReason :: error_reason().
-spec encode_path_stop(EncoderState, PathTermValue) -> {EncoderState, Result} when EncoderState :: state(), PathTermValue :: argo_term:term_value(), Result :: result(PathTermValue, ErrorReason), ErrorReason :: error_reason().
-spec encode_record(EncoderState, RecordWireTypeHint, RecordValue) -> {EncoderState, Result} when EncoderState :: state(), RecordWireTypeHint :: argo_term:record_wire_type_hint(), RecordValue :: argo_record_value:t(), Result :: result(RecordTermValue, ErrorReason), RecordTermValue :: argo_term:term_value(), ErrorReason :: error_reason().
Link to this function
encode_record_next(EncoderState, Index, FieldWireTypeHint, OptionFieldTermValue, RecordTermValue)
View Source-spec encode_record_next(EncoderState, Index, FieldWireTypeHint, OptionFieldTermValue, RecordTermValue) -> {EncoderState, Result} when EncoderState :: state(), Index :: argo_types:index(), FieldWireTypeHint :: argo_term:field_wire_type_hint(), OptionFieldTermValue :: argo_types:option(FieldTermValue), FieldTermValue :: argo_term:term_value(), RecordTermValue :: argo_term:term_value(), Result :: result(RecordTermValue, ErrorReason), ErrorReason :: error_reason().
Link to this function
encode_record_stop(EncoderState, RecordWireTypeHint, RecordTermValue)
View Source-spec encode_record_stop(EncoderState, RecordWireTypeHint, RecordTermValue) -> {EncoderState, Result} when EncoderState :: state(), RecordWireTypeHint :: argo_term:record_wire_type_hint(), RecordTermValue :: argo_term:term_value(), Result :: result(RecordTermValue, ErrorReason), ErrorReason :: error_reason().
-spec encode_scalar(EncoderState, ScalarWireTypeHint, ScalarTermValue) -> {EncoderState, Result} when EncoderState :: state(), ScalarWireTypeHint :: argo_term:scalar_wire_type_hint(), ScalarTermValue :: argo_term:term_value(), Result :: result(ScalarTermValue, ErrorReason), ErrorReason :: error_reason().