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

48 lines
1.4 KiB
Go

// Code generated by protoc-gen-micro
// source: service.proto
package service
import (
"context"
micro_api "github.com/unistack-org/micro/v3/api"
micro_client "github.com/unistack-org/micro/v3/client"
micro_server "github.com/unistack-org/micro/v3/server"
)
// NewConfigEndpoints provides api endpoints metdata for Config service
func NewConfigEndpoints() []*micro_api.Endpoint {
var endpoints []*micro_api.Endpoint
return endpoints
}
// ConfigService interface
type ConfigService interface {
Load(context.Context, *LoadRequest, ...micro_client.CallOption) (*LoadResponse, error)
Save(context.Context, *SaveRequest, ...micro_client.CallOption) (*SaveResponse, error)
}
// Micro server stuff
// ConfigHandler server handler
type ConfigHandler interface {
Load(context.Context, *LoadRequest, *LoadResponse) error
Save(context.Context, *SaveRequest, *SaveResponse) error
}
// RegisterConfigHandler registers server handler
func RegisterConfigHandler(s micro_server.Server, sh ConfigHandler, opts ...micro_server.HandlerOption) error {
type config interface {
Load(context.Context, *LoadRequest, *LoadResponse) error
Save(context.Context, *SaveRequest, *SaveResponse) error
}
type Config struct {
config
}
h := &configHandler{sh}
for _, endpoint := range NewConfigEndpoints() {
opts = append(opts, micro_api.WithEndpoint(endpoint))
}
return s.Handle(s.NewHandler(&Config{h}, opts...))
}