Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
2024-12-11 02:00:29 +03:00
parent e7e1ff15f4
commit 1aa324c17f
63 changed files with 2488 additions and 1165 deletions

26
proto/unmrashal_test.go Normal file
View File

@@ -0,0 +1,26 @@
package pb
import (
"fmt"
"testing"
cp "go.unistack.org/micro-codec-proto/v3"
)
func TestMarshalUnmarshal(t *testing.T) {
c := cp.NewCodec()
msg2 := &Message2{Items: []*Item2{{Key1: "akey1", Key2: "akey2"}, {Key1: "bkey1", Key2: "bkey2"}}}
buf, err := c.Marshal(msg2)
if err != nil {
t.Fatal(err)
}
msg1 := &Message1{}
err = c.Unmarshal(buf, msg1)
if err != nil {
t.Fatal(err)
}
for _, item := range msg1.Items {
fmt.Printf("item %#+v\n", item)
}
}