web

package
v0.0.0-...-f16f5cb Latest Latest
Warning

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

Go to latest
Published: May 21, 2023 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var RouterDraw func(router *Router)

Functions

func Init

func Init()

func RegisterController

func RegisterController(controller Controller)

func Start

func Start()

func Test

func Test(req *http.Request, msTimeout ...int) (*http.Response, error)

Types

type AFH

type AFH = map[string][]string

type BaseController

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

func (*BaseController) ActionName

func (c *BaseController) ActionName() string

func (*BaseController) AfterAction

func (c *BaseController) AfterAction(filter func(), options ...AFH)

func (*BaseController) BeforeAction

func (c *BaseController) BeforeAction(filter func(), options ...AFH)

func (*BaseController) BodyBing

func (c *BaseController) BodyBing(obj any)

func (*BaseController) ControllerName

func (c *BaseController) ControllerName() string

func (*BaseController) Cookie

func (c *BaseController) Cookie(name string, val ...any) string

func (*BaseController) DB

func (c *BaseController) DB() *gorm.DB

func (*BaseController) FormValue

func (c *BaseController) FormValue(name string, defaultValue ...string) string

func (*BaseController) Header

func (c *BaseController) Header(name string, val ...string) string

func (*BaseController) Json

func (c *BaseController) Json(obj any)

func (*BaseController) Param

func (c *BaseController) Param(name string) string

func (*BaseController) Query

func (c *BaseController) Query(name string, defaultValue ...string) string

func (*BaseController) QueryBind

func (c *BaseController) QueryBind(obj any)

func (*BaseController) RedirectTo

func (c *BaseController) RedirectTo(url string, status int)

func (*BaseController) Session

func (c *BaseController) Session(name string, val ...any) any

func (*BaseController) Text

func (c *BaseController) Text(body string)

type Controller

type Controller interface {
	Text(string)
}

type HttpContext

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

func (*HttpContext) BodyBind

func (h *HttpContext) BodyBind(obj any) error

func (*HttpContext) FormValue

func (h *HttpContext) FormValue(name string, defaultValue ...string) string

func (*HttpContext) GetHeader

func (h *HttpContext) GetHeader(key string) string

func (*HttpContext) Param

func (h *HttpContext) Param(name string, defaultValue ...string) string

func (*HttpContext) Query

func (h *HttpContext) Query(name string, defaultValue ...string) string

func (*HttpContext) QueryBind

func (h *HttpContext) QueryBind(obj any) error

func (*HttpContext) RedirectTo

func (h *HttpContext) RedirectTo(url string, status int)

func (*HttpContext) SetHeader

func (h *HttpContext) SetHeader(key, value string)

type Router

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

func (*Router) DELETE

func (r *Router) DELETE(path, to string)

func (*Router) GET

func (r *Router) GET(path, to string)

func (*Router) Namespace

func (r *Router) Namespace(name string, block func(router *Router))

func (*Router) POST

func (r *Router) POST(path, to string)

func (*Router) PUT

func (r *Router) PUT(path, to string)

func (*Router) Resources

func (r *Router) Resources(name string)

func (*Router) Scope

func (r *Router) Scope(name string, block func(router *Router))

type RouterInfo

type RouterInfo struct {
	Method       string
	Path         string
	StructName   string
	StructMethod string
}

func AllRoutes

func AllRoutes() []RouterInfo

Jump to

Keyboard shortcuts

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