mirror of
https://github.com/kevin-DL/services.git
synced 2026-01-12 03:05:14 +00:00
128 lines
3.6 KiB
Go
128 lines
3.6 KiB
Go
// Code generated by protoc-gen-micro. DO NOT EDIT.
|
|
// source: proto/forex.proto
|
|
|
|
package forex
|
|
|
|
import (
|
|
fmt "fmt"
|
|
proto "github.com/golang/protobuf/proto"
|
|
math "math"
|
|
)
|
|
|
|
import (
|
|
context "context"
|
|
api "github.com/micro/micro/v3/service/api"
|
|
client "github.com/micro/micro/v3/service/client"
|
|
server "github.com/micro/micro/v3/service/server"
|
|
)
|
|
|
|
// Reference imports to suppress errors if they are not otherwise used.
|
|
var _ = proto.Marshal
|
|
var _ = fmt.Errorf
|
|
var _ = math.Inf
|
|
|
|
// This is a compile-time assertion to ensure that this generated file
|
|
// is compatible with the proto package it is being compiled against.
|
|
// A compilation error at this line likely means your copy of the
|
|
// proto package needs to be updated.
|
|
const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
|
|
|
|
// Reference imports to suppress errors if they are not otherwise used.
|
|
var _ api.Endpoint
|
|
var _ context.Context
|
|
var _ client.Option
|
|
var _ server.Option
|
|
|
|
// Api Endpoints for Forex service
|
|
|
|
func NewForexEndpoints() []*api.Endpoint {
|
|
return []*api.Endpoint{}
|
|
}
|
|
|
|
// Client API for Forex service
|
|
|
|
type ForexService interface {
|
|
Quote(ctx context.Context, in *QuoteRequest, opts ...client.CallOption) (*QuoteResponse, error)
|
|
Price(ctx context.Context, in *PriceRequest, opts ...client.CallOption) (*PriceResponse, error)
|
|
History(ctx context.Context, in *HistoryRequest, opts ...client.CallOption) (*HistoryResponse, error)
|
|
}
|
|
|
|
type forexService struct {
|
|
c client.Client
|
|
name string
|
|
}
|
|
|
|
func NewForexService(name string, c client.Client) ForexService {
|
|
return &forexService{
|
|
c: c,
|
|
name: name,
|
|
}
|
|
}
|
|
|
|
func (c *forexService) Quote(ctx context.Context, in *QuoteRequest, opts ...client.CallOption) (*QuoteResponse, error) {
|
|
req := c.c.NewRequest(c.name, "Forex.Quote", in)
|
|
out := new(QuoteResponse)
|
|
err := c.c.Call(ctx, req, out, opts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *forexService) Price(ctx context.Context, in *PriceRequest, opts ...client.CallOption) (*PriceResponse, error) {
|
|
req := c.c.NewRequest(c.name, "Forex.Price", in)
|
|
out := new(PriceResponse)
|
|
err := c.c.Call(ctx, req, out, opts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *forexService) History(ctx context.Context, in *HistoryRequest, opts ...client.CallOption) (*HistoryResponse, error) {
|
|
req := c.c.NewRequest(c.name, "Forex.History", in)
|
|
out := new(HistoryResponse)
|
|
err := c.c.Call(ctx, req, out, opts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
// Server API for Forex service
|
|
|
|
type ForexHandler interface {
|
|
Quote(context.Context, *QuoteRequest, *QuoteResponse) error
|
|
Price(context.Context, *PriceRequest, *PriceResponse) error
|
|
History(context.Context, *HistoryRequest, *HistoryResponse) error
|
|
}
|
|
|
|
func RegisterForexHandler(s server.Server, hdlr ForexHandler, opts ...server.HandlerOption) error {
|
|
type forex interface {
|
|
Quote(ctx context.Context, in *QuoteRequest, out *QuoteResponse) error
|
|
Price(ctx context.Context, in *PriceRequest, out *PriceResponse) error
|
|
History(ctx context.Context, in *HistoryRequest, out *HistoryResponse) error
|
|
}
|
|
type Forex struct {
|
|
forex
|
|
}
|
|
h := &forexHandler{hdlr}
|
|
return s.Handle(s.NewHandler(&Forex{h}, opts...))
|
|
}
|
|
|
|
type forexHandler struct {
|
|
ForexHandler
|
|
}
|
|
|
|
func (h *forexHandler) Quote(ctx context.Context, in *QuoteRequest, out *QuoteResponse) error {
|
|
return h.ForexHandler.Quote(ctx, in, out)
|
|
}
|
|
|
|
func (h *forexHandler) Price(ctx context.Context, in *PriceRequest, out *PriceResponse) error {
|
|
return h.ForexHandler.Price(ctx, in, out)
|
|
}
|
|
|
|
func (h *forexHandler) History(ctx context.Context, in *HistoryRequest, out *HistoryResponse) error {
|
|
return h.ForexHandler.History(ctx, in, out)
|
|
}
|