github.com/kaydxh/golang@v0.0.131/go/net/grpc/example/data.repository.go (about) 1 package date 2 3 import ( 4 "context" 5 6 grpc_ "github.com/kaydxh/golang/go/net/grpc" 7 ) 8 9 type Repository struct { 10 grpc_.Repository[DateServiceClient] 11 } 12 13 func (r *Repository) Now(ctx context.Context, req *NowRequest) (resp *NowResponse, err error) { 14 15 err = r.Call(ctx, func(ctx context.Context) error { 16 nowResp, err := r.Client.Now(ctx, &NowRequest{}) 17 if err != nil { 18 return err 19 } 20 21 resp = &NowResponse{ 22 RequestId: req.RequestId, 23 Date: nowResp.GetDate(), 24 } 25 return nil 26 }) 27 28 return resp, err 29 }