goweb

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2024 License: MIT Imports: 14 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SanitizeHtml

func SanitizeHtml(html string) string

Types

type Context

type Context struct {
	Engine  *Engine
	Request *http.Request
	Writer  *ResponseWriter
	CT      time.Time
	Signal  chan int
	Data    map[string]interface{}

	StatusCode int
	FuncMap    map[string]interface{}
	Err        error
	// contains filtered or unexported fields
}

func (*Context) Abort

func (c *Context) Abort()

func (*Context) Failed

func (c *Context) Failed(error string)

func (*Context) Next

func (c *Context) Next()

func (*Context) RenderPage

func (ctx *Context) RenderPage(data interface{}, filenames ...string)

func (*Context) ShowErrorPage

func (c *Context) ShowErrorPage(status int, msg string)

func (*Context) String

func (c *Context) String() string

func (*Context) Success

func (c *Context) Success(data interface{})

type DefaultHanderWidget

type DefaultHanderWidget struct {
}

func (*DefaultHanderWidget) Post_Process

func (w *DefaultHanderWidget) Post_Process(ctx *Context)

func (*DefaultHanderWidget) Pre_Process

func (w *DefaultHanderWidget) Pre_Process(ctx *Context)

type Engine

type Engine struct {
	RouterGroup

	ConcurrenceNumSem chan int
	WM                *WidgetManager
	Logger            *log.Logger
	// contains filtered or unexported fields
}

func Default

func Default() *Engine

func (*Engine) ServeHTTP

func (engine *Engine) ServeHTTP(w http.ResponseWriter, req *http.Request)

type ErrorPageFunc

type ErrorPageFunc func(c *Context, status int, msg string)

type HandlerFunc

type HandlerFunc func(ctx *Context)

type HandlerResult

type HandlerResult struct {
	Error *string     `json:"error"`
	Data  interface{} `json:"data"`
}

func (HandlerResult) Write

func (hr HandlerResult) Write(w http.ResponseWriter)

type HandlerWidget

type HandlerWidget interface {
	Pre_Process(ctx *Context)
	Post_Process(ctx *Context)
}

type HandlersChain

type HandlersChain []HandlerFunc

type ResponseWriter

type ResponseWriter struct {
	http.ResponseWriter

	Compress bool
	// contains filtered or unexported fields
}

func (*ResponseWriter) Close

func (w *ResponseWriter) Close()

func (*ResponseWriter) EnsureInitialzed

func (w *ResponseWriter) EnsureInitialzed(compress bool)

func (*ResponseWriter) Header

func (w *ResponseWriter) Header() http.Header

func (*ResponseWriter) Write

func (w *ResponseWriter) Write(b []byte) (int, error)

func (*ResponseWriter) WriteHeader

func (w *ResponseWriter) WriteHeader(statusCode int)

type RouterGroup

type RouterGroup struct {
	Handlers HandlersChain
	// contains filtered or unexported fields
}

func (*RouterGroup) DELETE

func (group *RouterGroup) DELETE(path string, handler HandlerFunc)

func (*RouterGroup) GET

func (group *RouterGroup) GET(path string, handler HandlerFunc)

func (*RouterGroup) Group

func (group *RouterGroup) Group() *RouterGroup

func (*RouterGroup) POST

func (group *RouterGroup) POST(path string, handler HandlerFunc)

func (*RouterGroup) PUT

func (group *RouterGroup) PUT(path string, handler HandlerFunc)

func (*RouterGroup) RegexMatch

func (group *RouterGroup) RegexMatch(regexp *regexp.Regexp, handler HandlerFunc)

func (*RouterGroup) Use

func (group *RouterGroup) Use(middleware ...HandlerFunc)

type WidgetManager

type WidgetManager struct {
	HandlerWidget HandlerWidget
}

func NewWidgetManager

func NewWidgetManager() *WidgetManager

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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