webcontext

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2023 License: Apache-2.0 Imports: 12 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Context

type Context struct {
	context.Context

	Writer  http.ResponseWriter
	Request *http.Request

	URLParams map[string]string
	Tracer    trace.Tracer
	// contains filtered or unexported fields
}

func New

func New() *Context

func NewTestContext

func NewTestContext(writer http.ResponseWriter, r *http.Request) *Context

func (*Context) AddFieldError

func (wc *Context) AddFieldError(field string, err apierrors.FieldErrors)

func (*Context) Commit

func (wc *Context) Commit() error

func (*Context) GetValue

func (wc *Context) GetValue(key string) (obj any, exists bool)

func (*Context) HasErrors

func (wc *Context) HasErrors() bool

func (*Context) JSON

func (wc *Context) JSON(status int, response any)

func (*Context) MustGetValue

func (wc *Context) MustGetValue(key string) any

func (*Context) PrepareRequest

func (wc *Context) PrepareRequest(w http.ResponseWriter, r *http.Request) *Context

func (*Context) QueryParams

func (wc *Context) QueryParams() url.Values

func (*Context) Reject

func (wc *Context) Reject(status int, err *apierrors.APIError)

func (*Context) ResponseHeader

func (wc *Context) ResponseHeader() http.Header

func (*Context) SetStatus

func (wc *Context) SetStatus(status int)

func (*Context) SetValue

func (wc *Context) SetValue(key string, value any)

func (*Context) UrlParameters

func (wc *Context) UrlParameters() map[string]string

func (*Context) Write

func (wc *Context) Write(data []byte) (int, error)

Jump to

Keyboard shortcuts

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