33 lines
826 B
Go
33 lines
826 B
Go
|
// Code generated by protoc-gen-micro
|
||
|
// source: handler.proto
|
||
|
package pb
|
||
|
|
||
|
import (
|
||
|
context "context"
|
||
|
api "github.com/unistack-org/micro/v3/api"
|
||
|
codec "github.com/unistack-org/micro/v3/codec"
|
||
|
server "github.com/unistack-org/micro/v3/server"
|
||
|
)
|
||
|
|
||
|
type meterServer struct {
|
||
|
MeterServer
|
||
|
}
|
||
|
|
||
|
func (h *meterServer) Metrics(ctx context.Context, req *Empty, rsp *codec.Frame) error {
|
||
|
return h.MeterServer.Metrics(ctx, req, rsp)
|
||
|
}
|
||
|
|
||
|
func RegisterMeterServer(s server.Server, sh MeterServer, opts ...server.HandlerOption) error {
|
||
|
type meter interface {
|
||
|
Metrics(ctx context.Context, req *Empty, rsp *codec.Frame) error
|
||
|
}
|
||
|
type Meter struct {
|
||
|
meter
|
||
|
}
|
||
|
h := &meterServer{sh}
|
||
|
for _, endpoint := range NewMeterEndpoints() {
|
||
|
opts = append(opts, api.WithEndpoint(endpoint))
|
||
|
}
|
||
|
return s.Handle(s.NewHandler(&Meter{h}, opts...))
|
||
|
}
|