实现网关服务器不同版本客户端协议代理功能

This commit is contained in:
flswld
2022-12-25 00:42:07 +08:00
parent f4614b3df6
commit e96e9e3d3c
11 changed files with 374 additions and 36 deletions

View File

@@ -0,0 +1,49 @@
package reflection
import (
"fmt"
"testing"
)
type XXX struct {
Time int64
Date string
}
type YYY struct {
Ping uint16
}
type AAA struct {
Name string
UserId uint32
A uint8
X *XXX
Y YYY
}
type BBB struct {
Name string
UserId uint32
B uint8
X *XXX
Y YYY
}
func TestCopyStructSameField(t *testing.T) {
aaa := &AAA{
Name: "flswld",
UserId: 100000001,
A: 111,
X: &XXX{
Time: 150405,
Date: "2006-01-02",
},
Y: YYY{
Ping: 999,
},
}
bbb := new(BBB)
ok := CopyStructSameField(bbb, aaa)
fmt.Println(ok)
}