()
| 13 | var opts = conv.Options{} |
| 14 | |
| 15 | func ExampleBinaryConv_Do() { |
| 16 | // get descriptor and data |
| 17 | desc := getExampleDesc() |
| 18 | data := getExampleData() |
| 19 | |
| 20 | // make BinaryConv |
| 21 | cv := NewBinaryConv(opts) |
| 22 | |
| 23 | // do conversion |
| 24 | out, err := cv.Do(context.Background(), desc, data) |
| 25 | if err != nil { |
| 26 | panic(err) |
| 27 | } |
| 28 | |
| 29 | // validate result |
| 30 | exp := &example2.ExampleReq{} |
| 31 | err = json.Unmarshal(data, exp) |
| 32 | if err != nil { |
| 33 | panic(err) |
| 34 | } |
| 35 | act := &example2.ExampleReq{} |
| 36 | err = proto.Unmarshal(out, act) |
| 37 | if err != nil { |
| 38 | panic(err) |
| 39 | } |
| 40 | if !reflect.DeepEqual(exp, act) { |
| 41 | panic("not equal") |
| 42 | } |
| 43 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…