Documentation
¶
Index ¶
- func ContextWithUser(ctx context.Context, user *User) context.Context
- type Dashboard
- func (db *Dashboard) AbsLink(uri string) string
- func (db *Dashboard) GetAssetPrefix() string
- func (db *Dashboard) GetPathPrefix() string
- func (db *Dashboard) HTTPRouter() *xhttp.Router
- func (db *Dashboard) InitOnce()
- func (db *Dashboard) Render(ctx context.Context, w http.ResponseWriter, req *http.Request, fileName string, ...)
- func (db *Dashboard) RenderWithLayout(ctx context.Context, w http.ResponseWriter, req *http.Request, fileName string, ...)
- func (db *Dashboard) ServeHTTP(w http.ResponseWriter, req *http.Request)
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Dashboard ¶
type Dashboard struct {
PathPrefix string // uri 地址前缀,若为空,则默认为 /admin/
AssetPrefix string // 静态资源地址前缀,若为空,则默认为 /asset/
RegisterAsset string // 在 PathPrefix 下注册 asset 的目录名,若有值则会注册
Bundle *xi18n.Bundle // 国际化资源,可选
FuncMap template.FuncMap // 可选,注册到模版中的自定义方法
SecretKey string // 加密秘钥,必填
TemplateFS fs.FS // 模版文件,必填
Router *xhttp.Router // 路由,可选
UserFinder func(ctx context.Context, name string) (*User, error) // 操作用户,必填
UserCheckLogin func(ctx context.Context, req *http.Request, name string, psw string) (*User, error) // 用户登录,必填
// contains filtered or unexported fields
}
func (*Dashboard) GetAssetPrefix ¶
func (*Dashboard) GetPathPrefix ¶
func (*Dashboard) HTTPRouter ¶
func (*Dashboard) Render ¶
func (db *Dashboard) Render(ctx context.Context, w http.ResponseWriter, req *http.Request, fileName string, data map[string]any)
Render 渲染外部注册资源的模版文件
Click to show internal directories.
Click to hide internal directories.