Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
2022-01-24 22:44:26 +03:00
parent 8a71466ba4
commit 88a4c1641d
48 changed files with 200 additions and 137 deletions

24
codec/frame_test.go Normal file
View File

@@ -0,0 +1,24 @@
package codec
import (
"fmt"
"testing"
jsoncodec "go.unistack.org/micro-codec-json/v3"
"go.unistack.org/micro/v3/codec"
)
func TestFrame(t *testing.T) {
type FrameStruct struct {
Frame *codec.Frame `json:"frame"`
Name string `json:"name"`
}
dst := &FrameStruct{}
data := []byte(`{"name":"test","frame": {"first":"second"}}`)
c := jsoncodec.NewCodec()
if err := c.Unmarshal(data, dst); err != nil {
t.Fatal(err)
}
fmt.Printf("xxx %s\n", dst.Frame)
}