代码拉取完成,页面将自动刷新
package qor
import (
"net/http"
"github.com/jinzhu/gorm"
)
// CurrentUser is an interface, which is used for qor admin to get current logged user
type CurrentUser interface {
DisplayName() string
}
// Context qor context, which is used for many qor components, used to share information between them
type Context struct {
Request *http.Request
Writer http.ResponseWriter
CurrentUser CurrentUser
Roles []string
ResourceID string
DB *gorm.DB
Config *Config
Errors
}
// Clone clone current context
func (context *Context) Clone() *Context {
var clone = *context
return &clone
}
// GetDB get db from current context
func (context *Context) GetDB() *gorm.DB {
if context.DB != nil {
return context.DB
}
return context.Config.DB
}
// SetDB set db into current context
func (context *Context) SetDB(db *gorm.DB) {
context.DB = db
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。