11 Star 139 Fork 18

aurora-engine / aurora

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
system.go 840 Bytes
一键复制 编辑 原始数据 按行查看 历史
aurora.io 提交于 2023-02-27 23:49 . 修改 web 包路径
package aurora
import (
"gitee.com/aurora-engine/aurora/core"
"gitee.com/aurora-engine/web"
"reflect"
)
// Variate 向 Engine 中注册一个内部的系统变量,
// value将返回一个和v相同的类型,否则panic
// 提供自定义系统变量注册,参数列表中的自定义类型需要严格匹配
func (engine *Engine) Variate(v any, value web.Variate) {
if v == nil || value == nil {
return
}
rt := reflect.ValueOf(v)
if engine.intrinsic == nil {
engine.intrinsic = make(map[string]web.Variate)
}
key := core.BaseTypeKey(rt)
engine.intrinsic[key] = value
}
// Aurora 系统变量
func req(ctx web.Context) any {
return ctx.Request()
}
func rew(ctx web.Context) any {
return ctx.Response()
}
func ctx(ctx web.Context) any {
return ctx
}
func file(ctx web.Context) any {
return ctx.MultipartFile()
}
Go
1
https://gitee.com/aurora-engine/aurora.git
git@gitee.com:aurora-engine/aurora.git
aurora-engine
aurora
aurora
master

搜索帮助