grpcgw

package
v0.0.0-...-1d8daf6 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2020 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetOffsetAndLimit

func GetOffsetAndLimit(offset, limit int64) (int64, int64)

GetOffsetAndLimit return the offset and limit variable from the request, if not available return the default value

func Init

func Init() error

func NewBadRequest

func NewBadRequest(err error, message string) error

NewBadRequest is the bad request

func NewBadRequestStatus

func NewBadRequestStatus(err error, message string, status int) error

NewBadRequestStatus is the bad request

func NewNotFound

func NewNotFound(err error) error

NewNotFound return not found error

func RegisterController

func RegisterController(c Controller)

func RegisterInterceptors

func RegisterInterceptors(i Interceptor)

func Serve

func Serve(ctx context.Context) error

Types

type Controller

type Controller interface {
	InitRest(ctx context.Context, conn *grpc.ClientConn, mux *runtime.ServeMux)
	InitGrpc(ctx context.Context, server *grpc.Server)
}

type GWError

type GWError interface {
	error
	// Status is the http status code
	Status() int
	// Message to outside user
	Message() string
	// Fields return the fields or nil
	Fields() map[string]string
}

GWError is used for the error returned from the grpc implementation it can handle custom errors

type Interceptor

type Interceptor struct {
	Unary  grpc.UnaryServerInterceptor
	Stream grpc.StreamServerInterceptor
}

Jump to

Keyboard shortcuts

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