mirror of
https://github.com/FlourishingWorld/hk4e.git
synced 2026-02-04 18:32:26 +08:00
实现网关服务器不同版本客户端协议代理功能
This commit is contained in:
49
pkg/reflection/struct_test.go
Normal file
49
pkg/reflection/struct_test.go
Normal 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)
|
||||
}
|
||||
Reference in New Issue
Block a user