hgrpc

package module
v0.0.0-...-51d1f01 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2020 License: MIT Imports: 8 Imported by: 0

README

Hexa gRPC contains gRPC interceptors relative to Hexa

Requirements:

go : minimum version 1.13

Install

go get github.com/Kamva/hexa-grpc

Todo

  • Use recover interceptor in gRPC interceptors.
  • Set hexa logger as gRPC Logger (implement gRPC logger adapter by hexa logger)
  • Collection presenter
  • Write Tests
  • Add badges to readme.
  • CI

Documentation

Index

Constants

View Source
const ContextKeyHexaCtx = "__hexa_ctx__"

ContextKeyHexaCtx is the identifier to set the hexa context as a field in the context of a gRPC method.

Variables

View Source
var (
	ErrInvalidHexaContextPayload = status.Error(codes.Internal, "invalid hexa context payload provided to json marshaller")
)

Functions

func Ctx

func Ctx(ctx hexa.Context) context.Context

Ctx gets Hexa context and returns a context to pass to a gROC method.

Types

type HexaContextInterceptor

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

HexaContextInterceptor is the gRPC interceptor to pass hexa context through gRPC. Note: we do not provide stream interceptors, if you think need it, create PR or issue.

func NewHexaContextInterceptor

func NewHexaContextInterceptor(cei hexa.ContextExporterImporter) *HexaContextInterceptor

NewHexaContextInterceptor returns new instance of the HexaContextInterceptor.

func (*HexaContextInterceptor) UnaryClientInterceptor

func (ci *HexaContextInterceptor) UnaryClientInterceptor(ctx context.Context, method string, req interface{}, reply interface{}, cc *grpc.ClientConn, invoker grpc.UnaryInvoker, opts ...grpc.CallOption) error

func (*HexaContextInterceptor) UnaryServerInterceptor

func (ci *HexaContextInterceptor) UnaryServerInterceptor(c context.Context, req interface{}, info *grpc.UnaryServerInfo, h grpc.UnaryHandler) (interface{}, error)

Directories

Path Synopsis
examples

Jump to

Keyboard shortcuts

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