grpcstub

package
v0.1.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 21, 2024 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewServer

func NewServer(protoDir string, protoStubDir string) (*grpc.Server, error)

Types

type GRPCService

type GRPCService struct {
	// contains filtered or unexported fields
}

func New

func New(srv *grpc.Server, r Repository) GRPCService

func (*GRPCService) Handler

func (s *GRPCService) Handler(_ any, ctx context.Context, deccode func(any) error, _ grpc.UnaryServerInterceptor) (interface{}, error)

func (*GRPCService) LoadSpecs

func (s *GRPCService) LoadSpecs(protoDir string) error

func (*GRPCService) StreamHandler

func (s *GRPCService) StreamHandler(_ any, _ grpc.ServerStream) error

type Output

type Output struct {
	Data  json.RawMessage `json:"data"`
	Error string          `json:"error"`
	Code  *codes.Code     `json:"code,omitempty"`
}

type ProtoStorage added in v0.1.4

type ProtoStorage struct {
	// contains filtered or unexported fields
}

func NewStorage

func NewStorage() *ProtoStorage

func (*ProtoStorage) Add added in v0.1.4

func (p *ProtoStorage) Add(s ProtoStub)

func (*ProtoStorage) Get added in v0.1.4

func (p *ProtoStorage) Get(service string, method string, _ json.RawMessage) (Output, bool)

type ProtoStub

type ProtoStub struct {
	Service string `json:"service"`
	Method  string `json:"method"`
	Matcher string `json:"matcher"`
	Output  Output `json:"output"`
}

func Load

func Load(dir string) ([]ProtoStub, error)

type Repository

type Repository interface {
	Add(stub ProtoStub)
	Get(service string, method string, in json.RawMessage) (Output, bool)
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL