65 lines
1.2 KiB
Go
65 lines
1.2 KiB
Go
// Package asUtil -----------------------------
|
|
// @file : requestDataProtoRequestProProtoRequest_test.go
|
|
// @author : JJXu
|
|
// @contact : wavingbear@163.com
|
|
// @time : 2023/8/28 17:58
|
|
// -------------------------------------------
|
|
package asUtil
|
|
|
|
import (
|
|
"testing"
|
|
)
|
|
|
|
type CommonQuery struct {
|
|
Id int
|
|
Name string
|
|
}
|
|
type ProtoRequest struct {
|
|
Query *CommonQuery `json:"query"`
|
|
Page int64 `json:"page"`
|
|
PageSize int64 `json:"pageSize"`
|
|
}
|
|
type DataRequest struct {
|
|
CommonQuery
|
|
Page int64 `json:"page"`
|
|
PageSize int64 `json:"pageSize"`
|
|
}
|
|
|
|
func TestRequestDataConvert(t *testing.T) {
|
|
type args struct {
|
|
DataRequest interface{}
|
|
ProtoRequest interface{}
|
|
}
|
|
tests := []struct {
|
|
name string
|
|
args args
|
|
}{
|
|
{
|
|
name: "测似1",
|
|
args: args{
|
|
DataRequest: &DataRequest{
|
|
CommonQuery: CommonQuery{
|
|
Id: 1,
|
|
Name: "大佬个",
|
|
},
|
|
Page: 1,
|
|
PageSize: 100,
|
|
},
|
|
ProtoRequest: &ProtoRequest{
|
|
Query: &CommonQuery{
|
|
Id: 1,
|
|
Name: "大佬个",
|
|
},
|
|
Page: 1,
|
|
PageSize: 100,
|
|
},
|
|
},
|
|
},
|
|
}
|
|
for _, tt := range tests {
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
RequestDataConvert(tt.args.DataRequest, tt.args.ProtoRequest)
|
|
})
|
|
}
|
|
}
|