Documentation
¶
Index ¶
- Constants
- func Gopt_AppV2_Main(app AppType, handlers ...iHandler)
- func Gopt_App_Main(app AppType)
- func HUEeQW() error
- func SubFS(fsys fs.FS, dir string) (ret fs.FS)
- type App
- func (p *App) DELETE(path string, handle func(ctx *Context))
- func (p *App) Delete(path string, handle func(ctx *Context))
- func (p *App) GET(path string, handle func(ctx *Context))
- func (p *App) Get(path string, handle func(ctx *Context))
- func (p *App) HEAD(path string, handle func(ctx *Context))
- func (p *App) Head(path string, handle func(ctx *Context))
- func (p *App) OPTIONS(path string, handle func(ctx *Context))
- func (p *App) Options(path string, handle func(ctx *Context))
- func (p *App) PATCH(path string, handle func(ctx *Context))
- func (p *App) POST(path string, handle func(ctx *Context))
- func (p *App) PUT(path string, handle func(ctx *Context))
- func (p *App) Patch(path string, handle func(ctx *Context))
- func (p *App) Post(path string, handle func(ctx *Context))
- func (p *App) Put(path string, handle func(ctx *Context))
- func (p *App) Route(method, path string, handle func(ctx *Context))
- func (p *App) Static__0(pattern string, dir ...fs.FS)
- func (p *App) Static__1(pattern string, ctx context.Context, url string) (closer fsx.Closer, err error)
- func (p *App) Static__2(pattern string, fs http.FileSystem, allowRedirect ...bool)
- type AppType
- type AppV2
- func (p *AppV2) DELETE(path string, handle func(ctx *Context))
- func (p *AppV2) GET(path string, handle func(ctx *Context))
- func (p *AppV2) HEAD(path string, handle func(ctx *Context))
- func (p *AppV2) OPTIONS(path string, handle func(ctx *Context))
- func (p *AppV2) PATCH(path string, handle func(ctx *Context))
- func (p *AppV2) POST(path string, handle func(ctx *Context))
- func (p *AppV2) PUT(path string, handle func(ctx *Context))
- func (p *AppV2) Route(method, path string, handle func(ctx *Context))
- type Context
- func (p *Context) Accept(mime ...string) string
- func (p *Context) Binary__0(code int, mime string, data []byte)
- func (p *Context) Binary__1(code int, data []byte)
- func (p *Context) Binary__2(data []byte)
- func (p *Context) Binary__3(code int, data string)
- func (p *Context) Binary__4(data string)
- func (p *Context) DATA(code int, mime string, data []byte)
- func (p *Context) Gop_Env(name string) string
- func (p *Context) Html__0(code int, text string)
- func (p *Context) Html__1(text string)
- func (p *Context) Html__2(code int, text []byte)
- func (p *Context) Html__3(text []byte)
- func (p *Context) JSON(code int, data interface{})
- func (p *Context) Json__0(code int, data interface{})
- func (p *Context) Json__1(data interface{})
- func (p *Context) Param(name string) string
- func (p *Context) ParamInt(name string, defval int) int
- func (p *Context) PrettyJSON(code int, data interface{})
- func (p *Context) PrettyJson__0(code int, data interface{})
- func (p *Context) PrettyJson__1(data interface{})
- func (p *Context) Redirect(url string, code ...int)
- func (p *Context) TEXT(code int, mime string, text string)
- func (p *Context) Text__0(code int, mime string, text string)
- func (p *Context) Text__1(code int, text string)
- func (p *Context) Text__2(text string)
- func (p *Context) Text__3(code int, text []byte)
- func (p *Context) Text__4(text []byte)
- func (p *Context) YAP(code int, yapFile string, data interface{})
- func (p *Context) Yap__0(code int, yapFile string, data interface{})
- func (p *Context) Yap__1(yapFile string, data interface{})
- type Engine
- func (p *Engine) DELETE(path string, handle func(ctx *Context))
- func (p *Engine) FS(dir string) (ret fs.FS)
- func (p *Engine) GET(path string, handle func(ctx *Context))
- func (p *Engine) HEAD(path string, handle func(ctx *Context))
- func (p *Engine) Handle(pattern string, f func(ctx *Context))
- func (p *Engine) Handler(mws ...func(h http.Handler) http.Handler) http.Handler
- func (p *Engine) InitYap(fs ...fs.FS)
- func (p *Engine) NewContext(w http.ResponseWriter, r *http.Request) *Context
- func (p *Engine) OPTIONS(path string, handle func(ctx *Context))
- func (p *Engine) PATCH(path string, handle func(ctx *Context))
- func (p *Engine) POST(path string, handle func(ctx *Context))
- func (p *Engine) PUT(path string, handle func(ctx *Context))
- func (p *Engine) Route(method, path string, handle func(ctx *Context))
- func (p *Engine) Run(addr string, mws ...func(h http.Handler) http.Handler) error
- func (p *Engine) ServeHTTP(w http.ResponseWriter, req *http.Request)
- func (p *Engine) SetDelims(left, right string)
- func (p *Engine) SetLAS(listenAndServe func(addr string, handler http.Handler) error)
- func (p *Engine) Static(pattern string, dir ...fs.FS)
- func (p *Engine) StaticHttp(pattern string, fsys http.FileSystem, allowRedirect ...bool)
- type H
- type Handler
Constants ¶
const (
GopPackage = true
)
Variables ¶
This section is empty.
Functions ¶
func Gopt_AppV2_Main ¶
func Gopt_AppV2_Main(app AppType, handlers ...iHandler)
Gopt_AppV2_Main is required by Go+ compiler as the entry of a YAP project.
func Gopt_App_Main ¶
func Gopt_App_Main(app AppType)
Gopt_App_Main is required by Go+ compiler as the entry of a YAP project.
Types ¶
type App ¶
type App struct {
Engine
}
App is project class of YAP classfile (old version).
func (*App) Route ¶
Route registers a new request handle with the given path and method.
For GET, POST, PUT, PATCH and DELETE requests the respective shortcut functions can be used.
This function is intended for bulk loading and to allow the usage of less frequently used, non-standardized or custom methods (e.g. for internal communication with a proxy).
type AppType ¶
type AppType interface { InitYap(fs ...fs.FS) SetLAS(listenAndServe func(addr string, handler http.Handler) error) Route(method, path string, handle func(ctx *Context)) Handle(pattern string, f func(ctx *Context)) Run(addr string, mws ...func(h http.Handler) http.Handler) error }
AppType represents an abstract of YAP applications.
type AppV2 ¶
type AppV2 struct {
App
}
AppV2 is project class of YAP classfile (v2).
func (*AppV2) Route ¶
Route registers a new request handle with the given path and method.
For GET, POST, PUT, PATCH and DELETE requests the respective shortcut functions can be used.
This function is intended for bulk loading and to allow the usage of less frequently used, non-standardized or custom methods (e.g. for internal communication with a proxy).
type Context ¶
type Context struct { *http.Request http.ResponseWriter // contains filtered or unexported fields }
func (*Context) Accept ¶
Accept header specifies: Accept: <MIME_type>/<MIME_subtype> Accept: <MIME_type>/* Accept: */* Multiple types, weighted with the quality value syntax: Accept: text/html, application/xhtml+xml, application/xml;q=0.9, image/webp, */*;q=0.8 FIXME: 1. quality value not supported, 2. don't need parse all, just find the first match with a spliter iterator
func (*Context) Gop_Env ¶
Gop_Env returns the value associated with the name. If the name exists in URL query, it returns the first value for the name.
func (*Context) Param ¶
Param returns the value associated with the name. If the name exists in URL query, it returns the first value for the name.
func (*Context) PrettyJSON ¶
func (*Context) PrettyJson__0 ¶
func (*Context) PrettyJson__1 ¶
func (p *Context) PrettyJson__1(data interface{})
type Engine ¶
func (*Engine) NewContext ¶
func (*Engine) Route ¶
Route registers a new request handle with the given path and method.
For GET, POST, PUT, PATCH and DELETE requests the respective shortcut functions can be used.
This function is intended for bulk loading and to allow the usage of less frequently used, non-standardized or custom methods (e.g. for internal communication with a proxy).
func (*Engine) Run ¶
Run listens on the TCP network address addr and then calls Serve with handler to handle requests on incoming connections. Accepted connections are configured to enable TCP keep-alives.
func (*Engine) ServeHTTP ¶
func (p *Engine) ServeHTTP(w http.ResponseWriter, req *http.Request)
ServeHTTP makes the router implement the http.Handler interface.
func (*Engine) SetDelims ¶
SetDelims sets the action delimiters to the specified strings. Nested template definitions will inherit the settings. An empty delimiter stands for the corresponding default: {{ or }}.
func (*Engine) SetLAS ¶
SetLAS sets listenAndServe func to listens on the TCP network address addr and to handle requests on incoming connections.
func (*Engine) StaticHttp ¶
func (p *Engine) StaticHttp(pattern string, fsys http.FileSystem, allowRedirect ...bool)
StaticHttp serves static files from fsys (http.FileSystem).