context

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Args

type Args struct {
	CmdArgs    []string
	FormParam1 string `json:"form_param1" form:"form_param1"`
	FormParam2 string `json:"form_param2" form:"form_param1"`
}

type Context

type Context struct {
	// contains filtered or unexported fields
}

Context represents the Context which holds the HTTP request and response. It has methods for the request query string, parameters, body, HTTP headers, and so on.

func (*Context) FastHttpCtx added in v0.0.8

func (c *Context) FastHttpCtx() *fasthttp.RequestCtx

func (*Context) FormFile

func (c *Context) FormFile(key string) (*multipart.FileHeader, error)

FormFile returns uploaded file associated with the given multipart form key.

The file is automatically deleted after returning from RequestHandler, so either move or copy uploaded file into new place if you want retaining it.

Use SaveMultipartFile function for permanently saving uploaded file.

The returned file header is valid until your request handler returns.

func (*Context) Get

func (c *Context) Get(key string) (value any, exists bool)

func (*Context) Keys

func (c *Context) Keys() (rawMap maps.IMap[string, any])

func (*Context) Logger

func (c *Context) Logger() *xlog.Logger

func (*Context) MustGet

func (c *Context) MustGet(key string) (value any)

func (*Context) Put

func (c *Context) Put(key string, value any)

func (*Context) Request

func (c *Context) Request() *fasthttp.Request

func (*Context) Response

func (c *Context) Response() *fasthttp.Response

type Ctx

type Ctx interface {
	Logger() *xlog.Logger
	Request() *fasthttp.Request
	Response() *fasthttp.Response
	FastHttpCtx() *fasthttp.RequestCtx
	FormFile(key string) (*multipart.FileHeader, error)
	Get(key string) (value any, exists bool)
	MustGet(key string) (value any)
	Put(key string, value any)
	Keys() maps.IMap[string, any]
}

func NewContext

func NewContext(ctx *fasthttp.RequestCtx, logs ...*xlog.Logger) Ctx

Jump to

Keyboard shortcuts

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