Documentation
¶
Index ¶
- func ErrorMsg(err error, msg ...string)
- func Log() web.Interceptor
- func NewRoute(engine *Engine) *route.Router
- func Run(app Application, opt ...Option) error
- type Application
- type DefaultLogger
- type Engine
- func (engine *Engine) Constraint(tag string, verify web.Verify)
- func (engine *Engine) Delete(url string, control any, interceptor ...web.Interceptor)
- func (engine *Engine) Get(url string, control any, interceptor ...web.Interceptor)
- func (engine *Engine) GetConfig() web.Config
- func (engine *Engine) Group(url string, interceptor ...web.Interceptor) *Group
- func (engine *Engine) Head(url string, control any, interceptor ...web.Interceptor)
- func (engine *Engine) Interceptors(interceptor ...web.Interceptor)
- func (engine *Engine) Post(url string, control any, interceptor ...web.Interceptor)
- func (engine *Engine) Put(url string, control any, interceptor ...web.Interceptor)
- func (engine *Engine) Root() string
- func (engine *Engine) Use(Configuration ...any)
- func (engine *Engine) Variate(v any, value web.Variate)
- func (engine *Engine) ViewHandle(v web.ViewHandle)
- type Group
- func (g *Group) Delete(url string, control any, interceptor ...web.Interceptor)
- func (g *Group) Get(url string, control any, interceptor ...web.Interceptor)
- func (g *Group) Group(url string, middleware ...web.Interceptor) *Group
- func (g *Group) Head(url string, control any, middleware ...web.Interceptor)
- func (g *Group) Interceptors(interceptor ...web.Interceptor)
- func (g *Group) Post(url string, control any, interceptor ...web.Interceptor)
- func (g *Group) Put(url string, control any, interceptor ...web.Interceptor)
- type Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Log ¶
func Log() web.Interceptor
Types ¶
type Application ¶
type Application interface { // Use 加载配置 Use(...interface{}) // Server 服务器初始化 // 依赖加载 等操作在这个函数中进行 Server() // Router 路由加载函数 Router() // contains filtered or unexported methods }
Application Web 应用程序接口 通过嵌套匿名 *Engine 实例来完成web服务的构建
type DefaultLogger ¶ added in v1.3.17
type DefaultLogger struct { }
func (*DefaultLogger) After ¶ added in v1.3.17
func (logger *DefaultLogger) After(ctx web.Context, handler any) error
type Engine ¶ added in v1.1.1
type Engine struct { // 日志 *zap.Logger Level string // 开发模式 // 跨域工具 Cors web.CorsHandle // 文件上传大小配置 MaxMultipartMemory int64 // 服务端口号 Port string // 路由服务管理 Route *route.Router validator.Validate // contains filtered or unexported fields }
func New ¶ added in v1.1.1
New 创建 Aurora 实例 优先创建基础 Engine 实例 读取配置文件 创建路由 加载 Option 再次读取配置文件 Option 中可以进行任意的配置操作
func NewEngine ¶ added in v1.3.1
func NewEngine() *Engine
NewEngine 创建 Engine 基础配置 初始化默认端口号 创建 http 服务 初始化默认日志 初始化系统参数列表 加载配置文件
func (*Engine) Constraint ¶ added in v1.3.5
Constraint 参数验证器
func (*Engine) Delete ¶ added in v1.1.1
func (engine *Engine) Delete(url string, control any, interceptor ...web.Interceptor)
Delete 请求
func (*Engine) Get ¶ added in v1.1.1
func (engine *Engine) Get(url string, control any, interceptor ...web.Interceptor)
Get 请求
func (*Engine) Group ¶ added in v1.1.1
func (engine *Engine) Group(url string, interceptor ...web.Interceptor) *Group
Group 路由分组 必须以 “/” 开头分组 Group 和 Aurora 都有 相同的 http 方法注册
func (*Engine) Head ¶ added in v1.1.1
func (engine *Engine) Head(url string, control any, interceptor ...web.Interceptor)
Head 请求
func (*Engine) Interceptors ¶ added in v1.3.17
func (engine *Engine) Interceptors(interceptor ...web.Interceptor)
Interceptors 注册全局拦截器
func (*Engine) Post ¶ added in v1.1.1
func (engine *Engine) Post(url string, control any, interceptor ...web.Interceptor)
Post 请求
func (*Engine) Put ¶ added in v1.1.1
func (engine *Engine) Put(url string, control any, interceptor ...web.Interceptor)
Put 请求
func (*Engine) Variate ¶ added in v1.3.1
Variate 向 Engine 中注册一个内部的系统变量, value将返回一个和v相同的类型,否则panic 提供自定义系统变量注册,参数列表中的自定义类型需要严格匹配
func (*Engine) ViewHandle ¶ added in v1.3.1
func (engine *Engine) ViewHandle(v web.ViewHandle)
ViewHandle 修改默认视图解析接口 Aurora 的路由树初始化默认使用的 Aurora 自己实现的视图解析 通过 该方法可以重新设置视图解析的逻辑处理,或者使用其他第三方的视图处理 现在的试图处理器处理方式比较局限,后续根据开发者需求进一步调整
type Group ¶
type Group struct {
// contains filtered or unexported fields
}
Group 路由分组 初始化的 分组变量不会携带全局的Use group 可以设定局部的全局Use
func (*Group) Delete ¶
func (g *Group) Delete(url string, control any, interceptor ...web.Interceptor)
Delete 请求
func (*Group) Get ¶
func (g *Group) Get(url string, control any, interceptor ...web.Interceptor)
Get 请求
func (*Group) Group ¶
func (g *Group) Group(url string, middleware ...web.Interceptor) *Group
Group 路由分组 必须以 “/” 开头分组
func (*Group) Head ¶
func (g *Group) Head(url string, control any, middleware ...web.Interceptor)
Head 请求
func (*Group) Interceptors ¶ added in v1.3.17
func (g *Group) Interceptors(interceptor ...web.Interceptor)
Interceptors 基于 group 的分组添加 Middleware
type Option ¶
type Option func(*Engine)
func ConfigFilePath ¶ added in v1.3.9
ConfigFilePath 指定 Aurora 加载配置文件位置
func Level ¶ added in v1.3.17
Level 设置配置文件等级 仅仅适用于在本地调试运行期间通过本api能够快捷切换多种版本的配置文件 go build 推荐使用 embed 方式初始化配置 Level Config ConfigFilePath LoadConfig 之间的配置加载是有冲突的
func LoadConfig ¶ added in v1.3.9
LoadConfig 加载配置文件数据 该方法只适用于 本地配置文件 embed 方式加载配置文件数据,初始化配置实例还是默认的 如果想要 第三方数据源 请使用 Config 方法替换掉 默认的配置实例
func MaxMultipartMemory ¶ added in v1.3.10
MaxMultipartMemory 添加全局设置文件上传大小