Documentation ¶
Index ¶
- func CreateCtxWithReqHeader(ctx context.Context, header *RequestHeader) context.Context
- func CreateCtxWithReqID(ctx context.Context, reqId string) context.Context
- func CreateCtxWithRspHeader(ctx context.Context, header *ResponseHeader) context.Context
- func GetReqID(ctx context.Context) string
- func WrapHandler[Req any, Rsp any](handle func(ctx context.Context, req *Req) (rsp *Rsp, err error)) func(ctx *fiber.Ctx) error
- type Close
- type GrpcHandler
- type HandlerFunc
- type HttpRouter
- type Init
- type Middleware
- type Request
- type RequestHeader
- type Response
- type ResponseHeader
- type Service
- type TwirpServer
- type Validator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateCtxWithReqHeader ¶
func CreateCtxWithReqHeader(ctx context.Context, header *RequestHeader) context.Context
func CreateCtxWithReqID ¶
func CreateCtxWithRspHeader ¶
func CreateCtxWithRspHeader(ctx context.Context, header *ResponseHeader) context.Context
Types ¶
type GrpcHandler ¶
type GrpcHandler interface { Init() Middlewares() []Middleware ServiceDesc() *grpc.ServiceDesc Gateway(opts []interface{}) TwirpServer }
type HttpRouter ¶
type HttpRouter interface { Init() Middlewares() []Middleware Router(app *fiber.App) Openapi(swag *opendoc.Swagger) }
type Middleware ¶
type Middleware func(next HandlerFunc) HandlerFunc
func Chain ¶
func Chain(m ...Middleware) 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
func GetReqHeader ¶
func GetReqHeader(ctx context.Context) *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
func GetRspHeader ¶
func GetRspHeader(ctx context.Context) *ResponseHeader
type TwirpServer ¶
type TwirpServer interface { http.Handler // ServiceDescriptor returns gzipped bytes describing the .proto file that // this service was generated from. Once unzipped, the bytes can be // unmarshalled as a // google.golang.org/protobuf/types/descriptorpb.FileDescriptorProto. // // The returned integer is the index of this particular service within that // FileDescriptorProto's 'Service' slice of ServiceDescriptorProtos. This is a // low-level field, expected to be used for reflection. ServiceDescriptor() ([]byte, int) // ProtocGenTwirpVersion is the semantic version string of the version of // twirp used to generate this file. ProtocGenTwirpVersion() string // PathPrefix returns the HTTP URL path prefix for all methods handled by this // service. This can be used with an HTTP mux to route Twirp requests. // The path prefix is in the form: "/<prefix>/<package>.<Service>/" // that is, everything in a Twirp route except for the <Method> at the end. PathPrefix() string }
Click to show internal directories.
Click to hide internal directories.