()
| 90 | } |
| 91 | |
| 92 | func ExampleBinaryProtocol_ReadAnyWithDesc() { |
| 93 | p1, err := NewDescritorFromPath(context.Background(), "../testdata/idl/example2.thrift") |
| 94 | if err != nil { |
| 95 | panic(err) |
| 96 | } |
| 97 | example2ReqDesc := p1.Functions()["ExampleMethod"].Request().Struct().FieldById(1).Type() |
| 98 | data, err := ioutil.ReadFile("../testdata/data/example2.bin") |
| 99 | if err != nil { |
| 100 | panic(err) |
| 101 | } |
| 102 | |
| 103 | p := NewBinaryProtocol(data) |
| 104 | v, err := p.ReadAnyWithDesc(example2ReqDesc, false, false, false, true) |
| 105 | if err != nil { |
| 106 | panic(err) |
| 107 | } |
| 108 | fmt.Printf("%#v", v) |
| 109 | p = NewBinaryProtocolBuffer() |
| 110 | err = p.WriteAnyWithDesc(example2ReqDesc, v, true, true, true) |
| 111 | if err != nil { |
| 112 | panic(err) |
| 113 | } |
| 114 | fmt.Printf("%x", p.RawBuf()) |
| 115 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…