Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
2024-12-11 02:00:29 +03:00
parent e7e1ff15f4
commit 1aa324c17f
63 changed files with 2488 additions and 1165 deletions

View File

@@ -1,19 +1,52 @@
// Code generated by protoc-gen-go-micro. DO NOT EDIT.
// protoc-gen-go-micro version: v3.10.2
// protoc-gen-go-micro version: v3.10.4
// source: test.proto
package pb
import (
context "context"
v3 "go.unistack.org/micro-client-http/v3"
v31 "go.unistack.org/micro-server-http/v3"
v31 "go.unistack.org/micro-client-http/v3"
v3 "go.unistack.org/micro-server-http/v3"
client "go.unistack.org/micro/v3/client"
server "go.unistack.org/micro/v3/server"
http "net/http"
time "time"
)
var (
TestServiceServerEndpoints = []v3.EndpointMetadata{
{
Name: "TestService.LookupUser",
Path: "/v1/user/{name}",
Method: "GET",
Body: "",
Stream: false,
},
{
Name: "TestService.UpdateUser",
Path: "/v1/user/{name}",
Method: "PUT",
Body: "*",
Stream: false,
},
{
Name: "TestService.DeleteUser",
Path: "/v1/user/{name}",
Method: "DELETE",
Body: "",
Stream: false,
},
{
Name: "TestService.MailUser",
Path: "/v1/user/{name}/mail",
Method: "POST",
Body: "*",
Stream: false,
},
}
)
type testServiceClient struct {
c client.Client
name string
@@ -27,11 +60,11 @@ func (c *testServiceClient) LookupUser(ctx context.Context, req *LookupUserReq,
errmap := make(map[string]interface{}, 1)
errmap["default"] = &Error{}
opts = append(opts,
v3.ErrorMap(errmap),
v31.ErrorMap(errmap),
)
opts = append(opts,
v3.Method(http.MethodGet),
v3.Path("/v1/user/{name}"),
v31.Method(http.MethodGet),
v31.Path("/v1/user/{name}"),
)
td := time.Duration(5000000000)
opts = append(opts, client.WithRequestTimeout(td))
@@ -47,12 +80,12 @@ func (c *testServiceClient) UpdateUser(ctx context.Context, req *UpdateUserReq,
errmap := make(map[string]interface{}, 1)
errmap["default"] = &Error{}
opts = append(opts,
v3.ErrorMap(errmap),
v31.ErrorMap(errmap),
)
opts = append(opts,
v3.Method(http.MethodPut),
v3.Path("/v1/user/{name}"),
v3.Body("*"),
v31.Method(http.MethodPut),
v31.Path("/v1/user/{name}"),
v31.Body("*"),
)
td := time.Duration(5000000000)
opts = append(opts, client.WithRequestTimeout(td))
@@ -68,11 +101,11 @@ func (c *testServiceClient) DeleteUser(ctx context.Context, req *DeleteUserReq,
errmap := make(map[string]interface{}, 1)
errmap["default"] = &Error{}
opts = append(opts,
v3.ErrorMap(errmap),
v31.ErrorMap(errmap),
)
opts = append(opts,
v3.Method(http.MethodDelete),
v3.Path("/v1/user/{name}"),
v31.Method(http.MethodDelete),
v31.Path("/v1/user/{name}"),
)
td := time.Duration(5000000000)
opts = append(opts, client.WithRequestTimeout(td))
@@ -88,12 +121,12 @@ func (c *testServiceClient) MailUser(ctx context.Context, req *MailUserReq, opts
errmap := make(map[string]interface{}, 1)
errmap["default"] = &Error{}
opts = append(opts,
v3.ErrorMap(errmap),
v31.ErrorMap(errmap),
)
opts = append(opts,
v3.Method(http.MethodPost),
v3.Path("/v1/user/{name}/mail"),
v3.Body("*"),
v31.Method(http.MethodPost),
v31.Path("/v1/user/{name}/mail"),
v31.Body("*"),
)
td := time.Duration(5000000000)
opts = append(opts, client.WithRequestTimeout(td))
@@ -153,6 +186,6 @@ func RegisterTestServiceServer(s server.Server, sh TestServiceServer, opts ...se
}
h := &testServiceServer{sh}
var nopts []server.HandlerOption
nopts = append(nopts, v31.HandlerEndpoints(TestServiceServerEndpoints))
nopts = append(nopts, v3.HandlerEndpoints(TestServiceServerEndpoints))
return s.Handle(s.NewHandler(&TestService{h}, append(nopts, opts...)...))
}