app

package
v0.0.0-...-678b904 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2019 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Static map[string]string = make(map[string]string) // 静态服务

Static 静态服务容器1

Functions

func AutoRouter

func AutoRouter(app IApp)

AutoRouter 注册路由

func Initmiddeware

func Initmiddeware()

初始化 middleware

func IsSetMiddleware

func IsSetMiddleware(cm string) bool

判断某个控制器下的方法是否已经注册过中间件

func IsShieldfunc

func IsShieldfunc(s string) bool

判断方法是否被屏蔽 屏蔽返回false

func Router

func Router(pattern string, app IApp)

Router 储存反射信息到路由

func ServerRun_Http

func ServerRun_Http(port string)

func SetMiddlewareCon

func SetMiddlewareCon(a IApp, f func(w http.ResponseWriter, r *http.Request))

控制器绑定

func SetMiddlewareFunc

func SetMiddlewareFunc(cm string, f func(w http.ResponseWriter, r *http.Request))

注册中间件 cm 控制器/方法 func 绑定的中间件方法

func SetShieldfuncs

func SetShieldfuncs()

设置 禁止URL执行的方法

Types

type App

type App struct {
	Data map[string]interface{} //信息数据
	// contains filtered or unexported fields
}

func (*App) Echo

func (a *App) Echo(htmlpath ...string)

解析模板并输出

func (*App) Init

func (a *App) Init(ctx *Context)

初始化

func (*App) R

func (a *App) R() *http.Request

获取Request

func (*App) W

func (a *App) W() http.ResponseWriter

获得 ResponseWriter

type Context

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

请求信息的封装

func (*Context) Config

func (c *Context) Config(w http.ResponseWriter, r *http.Request)

数据储存到结构

type IApp

type IApp interface {
	Init(ctx *Context) //初始化context
	W() http.ResponseWriter
	R() *http.Request
	Echo(htmlpath ...string)
}

type IContext

type IContext interface {
	Config(w http.ResponseWriter, r *http.Request)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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