ctx

package
v0.1.81 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2024 License: Apache-2.0 Imports: 0 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 interface {
	Request() Request
	Response() Response
	ReqStorage() ReqStorage
	MatchPath(pattern string, path string) bool
	IsValidContext() bool
}

type ReqStorage

type ReqStorage interface {
	Source() interface{}
	Get(key StorageKey) interface{}
	Set(key StorageKey, value string)
	Delete(key StorageKey)
}

ReqStorage Use to set-get-delete data,and it'll be cleaned after request

type Request

type Request interface {
	Source() interface{}
	// Header get from request header
	Header(key string) string
	// PostForm get value from postForm
	PostForm(key string) string
	// Query https://example.org/?a=1&a=2&b=&=3&&&&" Query(a) return 1
	Query(key string) string
	// Path https://example.org/ex?a=1&a=2&b=&=3&&&& Path() return /ex
	Path() string
	// Url https://example.org/?a=1&a=2&b=&=3&&&& Url() return https://example.org/?a=1&a=2&b=&=3&&&&
	Url() string
	// UrlNoQuery return Url without query param
	UrlNoQuery() string
	// Method request method
	Method() string
	// Cookie get value from cookie
	Cookie(key string) string
}

type Response

type Response interface {
	Source() interface{}
	DeleteCookie(name string, path string, domain string)
	AddCookie(name string, value string, path string, domain string, timeout int64)
	SetHeader(name string, value string)
	AddHeader(name string, value string)
	SetServer(value string)
	Redirect(url string)
	Status(status int)
}

type StorageKey

type StorageKey string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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