lava

package
v0.2.10-48 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateCtxWithClientInfo

func CreateCtxWithClientInfo(ctx context.Context, info *lavapbv1.ServiceInfo) context.Context

func CreateCtxWithReqID

func CreateCtxWithReqID(ctx context.Context, reqId string) context.Context

func CreateCtxWithServerInfo

func CreateCtxWithServerInfo(ctx context.Context, info *lavapbv1.ServiceInfo) context.Context

func GetClientInfo

func GetClientInfo(ctx context.Context) *lavapbv1.ServiceInfo

func GetReqID

func GetReqID(ctx context.Context) string

func GetServerInfo

func GetServerInfo(ctx context.Context) *lavapbv1.ServiceInfo

func WrapHandler

func WrapHandler[Req any, Rsp any](handle func(ctx context.Context, req *Req) (rsp *Rsp, err error)) func(ctx *fiber.Ctx) error

Types

type Close

type Close interface {
	Close()
}

type GrpcGatewayRouter

type GrpcGatewayRouter interface {
	GrpcRouter
	RegisterGateway(ctx context.Context, mux *runtime.ServeMux, conn grpc.ClientConnInterface) error
}

type GrpcRouter

type GrpcRouter interface {
	Middlewares() []Middleware
	ServiceDesc() *grpc.ServiceDesc
}

type HandlerFunc

type HandlerFunc func(ctx context.Context, req Request) (Response, error)

type HttpRouter

type HttpRouter interface {
	Middlewares() []Middleware
	Router(router fiber.Router)
	Openapi(doc *opendoc.Swagger)
}

type Init

type Init interface {
	Init()
}

type Initializer

type Initializer interface {
	Initialize()
}

Initializer ...

type Middleware

type Middleware interface {
	Middleware(next HandlerFunc) HandlerFunc
	String() string
}

func Chain

func Chain(m ...Middleware) Middleware

type MiddlewareWrap

type MiddlewareWrap struct {
	Next func(next HandlerFunc) HandlerFunc
	Name string
}

func (MiddlewareWrap) Middleware

func (m MiddlewareWrap) Middleware(next HandlerFunc) HandlerFunc

func (MiddlewareWrap) String

func (m MiddlewareWrap) String() string

type Middlewares

type Middlewares []Middleware

type Request

type Request interface {
	// Client server or client
	Client() bool

	// Kind [http|grpc...]
	Kind() string

	// Stream Indicates whether it's a stream
	Stream() bool

	// Service name requested
	Service() string

	// Operation requested
	Operation() string

	// Endpoint requested
	Endpoint() string

	// ContentType Content type provided
	ContentType() string

	// Header of the request
	Header() *RequestHeader

	// Payload is the decoded value
	Payload() interface{}
}

Request is a synchronous request interface

type RequestHeader

type RequestHeader = fasthttp.RequestHeader

type Response

type Response interface {
	Header() *ResponseHeader
	Payload() interface{}
	Stream() bool
}

Response is the response writer for un encoded messages

type ResponseHeader

type ResponseHeader = fasthttp.ResponseHeader

type Server

type Server interface {
	Serve(context.Context, net.Listener) error
}

Server provides an interface for starting and stopping the server.

type Service

type Service interface {
	Start()
	Stop()
	Run()
}

type Validator

type Validator interface {
	Validate() error
}

Jump to

Keyboard shortcuts

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