serverutils

package
v0.51.6 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GoContext

type GoContext struct {
	context.Context
	// contains filtered or unexported fields
}

func NewGoContext

func NewGoContext(ctx context.Context, echoContext echo.Context) *GoContext

func (*GoContext) Value

func (g *GoContext) Value(key any) interface{}

type ParamContext

type ParamContext interface {
	// Get retrieves data from the context.
	Get(key string) interface{}

	// Set saves data in the context.
	Set(key string, val interface{})

	// Param returns path parameter by name.
	Param(name string) string

	// ParamNames returns path parameter names.
	ParamNames() []string

	// ParamValues returns path parameter values.
	ParamValues() []string
}

ParamContext represents a subset of echo.Context to make testing easier

type RequestContext

type RequestContext struct {
	echo.Context
}

RequestContext wraps echo.Context but Get and Set set values on the request context, rather than the echo context. This is necessary when we use the oapi-gen StrictServerInterface, since the implemented methods are passed a request context, not an echo context. Thus, our middleware needs to write to the request context as well.

func NewRequestContext

func NewRequestContext(ctx echo.Context) *RequestContext

func (*RequestContext) Get

func (e *RequestContext) Get(key string) interface{}

func (*RequestContext) Set

func (e *RequestContext) Set(key string, val interface{})

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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