github.com/yoogoc/kratos-scaffold@v0.0.0-20240402032722-a538b3c18955/cmd/testdata/service-user_transfer.txt (about) 1 package service 2 3 import ( 4 v1 "test/api/user/v1" 5 "test/internal/biz" 6 ) 7 8 func createUserReq2Biz(req *v1.CreateUserRequest) *biz.User { 9 return &biz.User{ 10 Name: req.Name, 11 Age: req.Age, 12 } 13 } 14 15 func updateUserReq2Biz(req *v1.UpdateUserRequest) *biz.User { 16 return &biz.User{ 17 Id: req.Id, 18 Name: req.Name, 19 Age: req.Age, 20 } 21 } 22 23 func userBiz2Proto(item *biz.User) *v1.User { 24 return &v1.User{ 25 Id: item.Id, 26 Name: item.Name, 27 Age: item.Age, 28 } 29 } 30 31 func bulkUserBiz2Proto(list []*biz.User) []*v1.User { 32 var target []*v1.User 33 for _, item := range list { 34 target = append(target, userBiz2Proto(item)) 35 } 36 return target 37 } 38 39 func listUserReq2Biz(req *v1.ListUserRequest) *biz.UserParam { 40 return &biz.UserParam{ 41 IdEq: req.IdEq, 42 NameCont: req.NameCont, 43 AgeGTE: req.AgeGTE, 44 AgeLTE: req.AgeLTE, 45 } 46 }