@@ -1,18 +1,17 @@
|
||||
// Code generated by protoc-gen-go-micro. DO NOT EDIT.
|
||||
// protoc-gen-go-micro version: v3.4.1
|
||||
// protoc-gen-go-micro version: v3.4.2
|
||||
// source: test.proto
|
||||
|
||||
package pb
|
||||
|
||||
import (
|
||||
context "context"
|
||||
http "net/http"
|
||||
time "time"
|
||||
|
||||
v3 "github.com/unistack-org/micro-client-http/v3"
|
||||
api "github.com/unistack-org/micro/v3/api"
|
||||
client "github.com/unistack-org/micro/v3/client"
|
||||
server "github.com/unistack-org/micro/v3/server"
|
||||
http "net/http"
|
||||
time "time"
|
||||
)
|
||||
|
||||
type testServiceClient struct {
|
||||
@@ -32,7 +31,7 @@ func (c *testServiceClient) LookupUser(ctx context.Context, req *LookupUserReq,
|
||||
)
|
||||
opts = append(opts,
|
||||
v3.Method(http.MethodGet),
|
||||
v3.Path("/v1/user/lookup/{name}"),
|
||||
v3.Path("/v1/user/{name}"),
|
||||
)
|
||||
opts = append(opts, client.WithRequestTimeout(time.Second*5))
|
||||
rsp := &LookupUserRsp{}
|
||||
@@ -43,6 +42,65 @@ func (c *testServiceClient) LookupUser(ctx context.Context, req *LookupUserReq,
|
||||
return rsp, nil
|
||||
}
|
||||
|
||||
func (c *testServiceClient) UpdateUser(ctx context.Context, req *UpdateUserReq, opts ...client.CallOption) (*UpdateUserRsp, error) {
|
||||
errmap := make(map[string]interface{}, 1)
|
||||
errmap["default"] = &Error{}
|
||||
opts = append(opts,
|
||||
v3.ErrorMap(errmap),
|
||||
)
|
||||
opts = append(opts,
|
||||
v3.Method(http.MethodPut),
|
||||
v3.Path("/v1/user/{name}"),
|
||||
v3.Body("*"),
|
||||
)
|
||||
opts = append(opts, client.WithRequestTimeout(time.Second*5))
|
||||
rsp := &UpdateUserRsp{}
|
||||
err := c.c.Call(ctx, c.c.NewRequest(c.name, "TestService.UpdateUser", req), rsp, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return rsp, nil
|
||||
}
|
||||
|
||||
func (c *testServiceClient) DeleteUser(ctx context.Context, req *DeleteUserReq, opts ...client.CallOption) (*DeleteUserRsp, error) {
|
||||
errmap := make(map[string]interface{}, 1)
|
||||
errmap["default"] = &Error{}
|
||||
opts = append(opts,
|
||||
v3.ErrorMap(errmap),
|
||||
)
|
||||
opts = append(opts,
|
||||
v3.Method(http.MethodDelete),
|
||||
v3.Path("/v1/user/{name}"),
|
||||
)
|
||||
opts = append(opts, client.WithRequestTimeout(time.Second*5))
|
||||
rsp := &DeleteUserRsp{}
|
||||
err := c.c.Call(ctx, c.c.NewRequest(c.name, "TestService.DeleteUser", req), rsp, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return rsp, nil
|
||||
}
|
||||
|
||||
func (c *testServiceClient) MailUser(ctx context.Context, req *MailUserReq, opts ...client.CallOption) (*MailUserRsp, error) {
|
||||
errmap := make(map[string]interface{}, 1)
|
||||
errmap["default"] = &Error{}
|
||||
opts = append(opts,
|
||||
v3.ErrorMap(errmap),
|
||||
)
|
||||
opts = append(opts,
|
||||
v3.Method(http.MethodPost),
|
||||
v3.Path("/v1/user/{name}/mail"),
|
||||
v3.Body("*"),
|
||||
)
|
||||
opts = append(opts, client.WithRequestTimeout(time.Second*5))
|
||||
rsp := &MailUserRsp{}
|
||||
err := c.c.Call(ctx, c.c.NewRequest(c.name, "TestService.MailUser", req), rsp, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return rsp, nil
|
||||
}
|
||||
|
||||
type testServiceServer struct {
|
||||
TestServiceServer
|
||||
}
|
||||
@@ -54,9 +112,33 @@ func (h *testServiceServer) LookupUser(ctx context.Context, req *LookupUserReq,
|
||||
return h.TestServiceServer.LookupUser(ctx, req, rsp)
|
||||
}
|
||||
|
||||
func (h *testServiceServer) UpdateUser(ctx context.Context, req *UpdateUserReq, rsp *UpdateUserRsp) error {
|
||||
var cancel context.CancelFunc
|
||||
ctx, cancel = context.WithTimeout(ctx, time.Second*5)
|
||||
defer cancel()
|
||||
return h.TestServiceServer.UpdateUser(ctx, req, rsp)
|
||||
}
|
||||
|
||||
func (h *testServiceServer) DeleteUser(ctx context.Context, req *DeleteUserReq, rsp *DeleteUserRsp) error {
|
||||
var cancel context.CancelFunc
|
||||
ctx, cancel = context.WithTimeout(ctx, time.Second*5)
|
||||
defer cancel()
|
||||
return h.TestServiceServer.DeleteUser(ctx, req, rsp)
|
||||
}
|
||||
|
||||
func (h *testServiceServer) MailUser(ctx context.Context, req *MailUserReq, rsp *MailUserRsp) error {
|
||||
var cancel context.CancelFunc
|
||||
ctx, cancel = context.WithTimeout(ctx, time.Second*5)
|
||||
defer cancel()
|
||||
return h.TestServiceServer.MailUser(ctx, req, rsp)
|
||||
}
|
||||
|
||||
func RegisterTestServiceServer(s server.Server, sh TestServiceServer, opts ...server.HandlerOption) error {
|
||||
type testService interface {
|
||||
LookupUser(ctx context.Context, req *LookupUserReq, rsp *LookupUserRsp) error
|
||||
UpdateUser(ctx context.Context, req *UpdateUserReq, rsp *UpdateUserRsp) error
|
||||
DeleteUser(ctx context.Context, req *DeleteUserReq, rsp *DeleteUserRsp) error
|
||||
MailUser(ctx context.Context, req *MailUserReq, rsp *MailUserRsp) error
|
||||
}
|
||||
type TestService struct {
|
||||
testService
|
||||
|
Reference in New Issue
Block a user