Documentation ¶
Index ¶
- Variables
- func AddAPI(item []*APIItem)
- func AddMenu(item *MenuItem, parent uuid.UUID) bool
- func CheckPerm(perm map[uuid.UUID]*handler.Perm, target *handler.Perm) bool
- func GetMenuPluginID(req *Request) ([]uuid.UUID, error)
- func Init(r *gin.RouterGroup)
- type APIFunc
- type APIItem
- type APIMethod
- type MenuItem
- type PermCheckerFunc
- type Request
- type Response
- func APIAddGroup(req *Request) (*Response, error)
- func APIAddUser(req *Request) (*Response, error)
- func APIDeleteGroup(req *Request) (*Response, error)
- func APIDeleteNotification(req *Request) (*Response, error)
- func APIDeleteUser(req *Request) (*Response, error)
- func APIGetAccess(req *Request) (*Response, error)
- func APIGetCSRFToken(req *Request) (*Response, error)
- func APIGetGroup(req *Request) (*Response, error)
- func APIGetMenu(req *Request) (*Response, error)
- func APIGetNotification(req *Request) (*Response, error)
- func APIGetPlugin(req *Request) (*Response, error)
- func APIGetPluginEntry(req *Request) (*Response, error)
- func APIGetPublicSetting(req *Request) (*Response, error)
- func APIGetUser(req *Request) (*Response, error)
- func APIPing(req *Request) (*Response, error)
- func APIPutGroup(req *Request) (*Response, error)
- func APIPutPlugin(req *Request) (*Response, error)
- func APIReload(req *Request) (*Response, error)
- func APISignIn(req *Request) (*Response, error)
- func APISignOut(req *Request) (*Response, error)
- func NewPageResponse(data any, total int64) *Response
- type RspCode
Constants ¶
This section is empty.
Variables ¶
View Source
var ( API = []*APIItem{} Menu = []*MenuItem{} Router *gin.RouterGroup Locker sync.Mutex )
View Source
var RspMsg = [CodeMax]string{
"response.success",
"response.user.invalid",
"response.user.exist",
"response.recaptcha.invalid",
"response.restart",
"response.group.notexist",
"response.group.exist",
"response.group.rootupdate",
"response.group.rootdelete",
"response.plugin.notexist",
"response.plugin.formaterror",
"response.plugin.exist",
}
Functions ¶
func Init ¶
func Init(r *gin.RouterGroup)
Types ¶
type APIFunc ¶
APIFunc is API function type.
id is current user id when user signin, otherwise uuid.Nil.
return http response and error.
type APIItem ¶
type APIItem struct { Path string // API path Method APIMethod // API http method Perm *handler.Perm // API permission Func APIFunc // API function Checker PermCheckerFunc // custom perm checker, invoke when default perm check failed }
APIItem is API item struct.
type APIMethod ¶
type APIMethod int32
APIMethod is http method for API.
const ( // APIGet represents HTTP Get method APIGet APIMethod = iota // APIPost represents HTTP Post method APIPost // APIPut represents HTTP Put method APIPut // APIPatch represents HTTP Patch method APIPatch // APIDelete represents HTTP Delete method APIDelete // APIOptions represents HTTP Options method APIOptions // APIHead represents HTTP Head method APIHead // APIAny represents any HTTP method APIAny )
type MenuItem ¶
type PermCheckerFunc ¶
SNCheckerFunc is permission checker function type.
type Request ¶
type Request struct { ID uuid.UUID Context *gin.Context Logger *logrus.Entry Translator *i18n.Localizer Perm map[uuid.UUID]*handler.Perm }
func (*Request) ShouldBind ¶
func (*Request) ShouldBindQuery ¶
func (*Request) ShouldBindUri ¶
type Response ¶
type Response struct { HTTPCode int `json:"-"` Code RspCode `json:"code"` Msg string `json:"msg"` Data any `json:"data,omitempty"` }
func APIAddGroup ¶
func APIAddUser ¶
func APIDeleteGroup ¶
func APIDeleteNotification ¶
func APIDeleteUser ¶
func APIGetAccess ¶
func APIGetCSRFToken ¶
func APIGetGroup ¶
func APIGetMenu ¶
func APIGetNotification ¶
func APIGetPlugin ¶
func APIGetPluginEntry ¶
func APIGetPublicSetting ¶
func APIGetUser ¶
func APIPutGroup ¶
func APIPutPlugin ¶
func APISignOut ¶
func NewPageResponse ¶
Click to show internal directories.
Click to hide internal directories.