Mirror for Apache CouchDB

Clone this repo:
  1. 217438a v0.1.5 by Takeru Ohta · 4 years, 10 months ago main master 0.1.5
  2. 9f75747 Update .gitignore by Takeru Ohta · 4 years, 10 months ago
  3. 6395e27 Add `thrift_protocol:{decode_struct/2, encode_struct/2}` by Takeru Ohta · 4 years, 10 months ago
  4. eded491 v0.1.4 by Takeru Ohta · 4 years, 10 months ago 0.1.4
  5. 6a6df1e Remove deprecated field by Takeru Ohta · 4 years, 10 months ago

thrift_protocol

hex.pm version Build Status Code Coverage License: MIT

An Erlang implementation of Thrift protocol.

Documentation

Examples

Body =
    #thrift_protocol_struct{
        fields = #{1 => true, 2 => {i8, -1}}
    },
Message =
    #thrift_protocol_message{
        method_name = <<"foo">>,
        message_type = call,
        sequence_id = 0,
        body = Body
    },

Encoded = list_to_binary(thrift_protocol:encode_message(Message, compact)),
<<130,33,0,3,102,111,111,17,19,255,0>> = Encoded,

{Decoded, <<>>} = thrift_protocol:decode_message(Encoded, compact),
Message = Decoded.

References