[feat] Controller AuthDB 约束

This commit is contained in:
2023-07-13 13:54:21 +08:00
parent 05f7b872c7
commit a8084aee8c
2 changed files with 29 additions and 0 deletions
+12
View File
@@ -17,18 +17,26 @@ type Controller interface {
type HttpController interface {
Controller
// 获取用户信息
User() User
// 获取请求信息
Request() *http.Request
// 请求处理
Execute(GlobalParams) any
// 路由信息
Route() Route
// 内部调用
Call(code string, params map[string]any, category ...RouteCategory) (HttpResponse, error)
// 内部调用
// Invoke()
// 数据库权限
AuthDB() ResAuthDB
}
type WsController interface {
@@ -92,6 +100,10 @@ func (HttpBaseController) Execute(params GlobalParams) any {
return nil
}
func (HttpBaseController) AuthDB() ResAuthDB {
return ResAuthOn
}
func (WsBaseController) ExecuteWS(params GlobalParams) error {
return nil
}