24
codec/frame_test.go
Normal file
24
codec/frame_test.go
Normal 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)
|
||||
}
|
@@ -7,10 +7,11 @@
|
||||
package pb
|
||||
|
||||
import (
|
||||
reflect "reflect"
|
||||
|
||||
codec "go.unistack.org/micro/v3/codec"
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
reflect "reflect"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -38,6 +39,7 @@ var file_test_proto_rawDesc = []byte{
|
||||
var file_test_proto_goTypes = []interface{}{
|
||||
(*codec.Frame)(nil), // 0: micro.codec.Frame
|
||||
}
|
||||
|
||||
var file_test_proto_depIdxs = []int32{
|
||||
0, // 0: helloworld.Test.Call:input_type -> micro.codec.Frame
|
||||
0, // 1: helloworld.Test.Call:output_type -> micro.codec.Frame
|
||||
|
@@ -6,6 +6,7 @@ package pb
|
||||
|
||||
import (
|
||||
context "context"
|
||||
|
||||
api "go.unistack.org/micro/v3/api"
|
||||
client "go.unistack.org/micro/v3/client"
|
||||
codec "go.unistack.org/micro/v3/codec"
|
||||
|
@@ -6,6 +6,7 @@ package pb
|
||||
|
||||
import (
|
||||
context "context"
|
||||
|
||||
_ "go.unistack.org/micro-client-http/v3"
|
||||
api "go.unistack.org/micro/v3/api"
|
||||
client "go.unistack.org/micro/v3/client"
|
||||
|
@@ -1,4 +1,3 @@
|
||||
package grpc
|
||||
|
||||
//go:generate sh -c "protoc -I./proto -I. -I$(go list -f '{{ .Dir }}' -m go.unistack.org/micro-proto/v3) --go_out=paths=source_relative:./proto --go-micro_out=components='micro|http',debug=true,paths=source_relative:./proto proto/test.proto"
|
||||
|
||||
|
@@ -7,10 +7,11 @@
|
||||
package pb
|
||||
|
||||
import (
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -154,11 +155,14 @@ func file_test_proto_rawDescGZIP() []byte {
|
||||
return file_test_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_test_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
|
||||
var file_test_proto_goTypes = []interface{}{
|
||||
(*Request)(nil), // 0: helloworld.Request
|
||||
(*Response)(nil), // 1: helloworld.Response
|
||||
}
|
||||
var (
|
||||
file_test_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
|
||||
file_test_proto_goTypes = []interface{}{
|
||||
(*Request)(nil), // 0: helloworld.Request
|
||||
(*Response)(nil), // 1: helloworld.Response
|
||||
}
|
||||
)
|
||||
|
||||
var file_test_proto_depIdxs = []int32{
|
||||
0, // 0: helloworld.Test.Call:input_type -> helloworld.Request
|
||||
1, // 1: helloworld.Test.Call:output_type -> helloworld.Response
|
||||
|
@@ -6,6 +6,7 @@ package pb
|
||||
|
||||
import (
|
||||
context "context"
|
||||
|
||||
api "go.unistack.org/micro/v3/api"
|
||||
client "go.unistack.org/micro/v3/client"
|
||||
)
|
||||
|
@@ -6,6 +6,7 @@ package pb
|
||||
|
||||
import (
|
||||
context "context"
|
||||
|
||||
_ "go.unistack.org/micro-client-http/v3"
|
||||
api "go.unistack.org/micro/v3/api"
|
||||
client "go.unistack.org/micro/v3/client"
|
||||
|
Reference in New Issue
Block a user