micro-config-service/proto/service_micro_grpc.pb.go
Vasiliy Tolstov d439d06eaa initial import
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2021-01-13 09:06:45 +03:00

59 lines
1.4 KiB
Go

// Code generated by protoc-gen-micro
// source: service.proto
package service
import (
"context"
micro_client "github.com/unistack-org/micro/v3/client"
micro_server "github.com/unistack-org/micro/v3/server"
)
var (
_ micro_server.Option
_ micro_client.Option
)
type configService struct {
c micro_client.Client
name string
}
// Micro client stuff
// NewConfigService create new service client
func NewConfigService(name string, c micro_client.Client) ConfigService {
return &configService{c: c, name: name}
}
func (c *configService) Load(ctx context.Context, req *LoadRequest, opts ...micro_client.CallOption) (*LoadResponse, error) {
rsp := &LoadResponse{}
err := c.c.Call(ctx, c.c.NewRequest(c.name, "Config.Load", req), rsp, opts...)
if err != nil {
return nil, err
}
return rsp, nil
}
func (c *configService) Save(ctx context.Context, req *SaveRequest, opts ...micro_client.CallOption) (*SaveResponse, error) {
rsp := &SaveResponse{}
err := c.c.Call(ctx, c.c.NewRequest(c.name, "Config.Save", req), rsp, opts...)
if err != nil {
return nil, err
}
return rsp, nil
}
// Micro server stuff
type configHandler struct {
ConfigHandler
}
func (h *configHandler) Load(ctx context.Context, req *LoadRequest, rsp *LoadResponse) error {
return h.ConfigHandler.Load(ctx, req, rsp)
}
func (h *configHandler) Save(ctx context.Context, req *SaveRequest, rsp *SaveResponse) error {
return h.ConfigHandler.Save(ctx, req, rsp)
}