Documentation
¶
Index ¶
- Variables
- func Build() *webserver.WebHandlers
- func Init()
- func Register(funcId string, funcService IFuncService)
- type FuncCtxHandler
- type FuncService
- func (self *FuncService) Check()
- func (self *FuncService) CheckSessionToken(ctx *gin.Context) gin.HandlerFunc
- func (self *FuncService) Delete(ctx *gin.Context, key string)
- func (self *FuncService) ExeBody(ctx *gin.Context, dto any) error
- func (self *FuncService) ExeFunc(c *gin.Context) (any, error)
- func (self *FuncService) Execute(ctx *gin.Context)
- func (self *FuncService) FindNameOfIface() string
- func (self *FuncService) Get(ctx *gin.Context, key string) any
- func (self *FuncService) GetFuncService() *FuncService
- func (self *FuncService) GetParam2Bool(c *gin.Context, key string) bool
- func (self *FuncService) GetParam2Int32(c *gin.Context, key string) int32
- func (self *FuncService) GetParam2Int64(c *gin.Context, key string) int64
- func (self *FuncService) GetParam2Str(c *gin.Context, key string) string
- func (self *FuncService) GetQuery2Bool(c *gin.Context, key string) bool
- func (self *FuncService) GetQuery2Int32(c *gin.Context, key string) int32
- func (self *FuncService) GetQuery2Int64(c *gin.Context, key string) int64
- func (self *FuncService) GetQuery2Str(c *gin.Context, key string) string
- func (self *FuncService) GetSessionToken(ctx *gin.Context) (int, *webdto.WebUserId, error)
- func (self *FuncService) GetUserId(ctx *gin.Context) *webdto.WebUserId
- func (self *FuncService) GetUserIdErr(c *gin.Context) (*webdto.WebUserId, error)
- func (self *FuncService) HandleError(c *gin.Context, err error)
- func (self *FuncService) IfWebHandlers() bool
- func (self *FuncService) Init(srv IFuncService)
- func (self *FuncService) InitRoute(ifuncservice IFuncService, method webserver.HttpMethod, path string)
- func (self *FuncService) InitRouter(funcservice IFuncService, webGroupPath ...string)
- func (self *FuncService) Names() string
- func (self *FuncService) NamesOf(some any) string
- func (self *FuncService) ParseBody(ctx *gin.Context, dto any) error
- func (self *FuncService) ParseBodyOnly(ctx *gin.Context, dto any) error
- func (self *FuncService) ParseResult(ctx *gin.Context, data interface{}) bool
- func (self *FuncService) Register()
- func (self *FuncService) RegisterDelete(path string, handler gin.HandlerFunc)
- func (self *FuncService) RegisterGet(path string, handler gin.HandlerFunc)
- func (self *FuncService) RegisterGetRes(path string, handler gin.HandlerFunc, checkRes ...string)
- func (self *FuncService) RegisterPatch(path string, handler gin.HandlerFunc)
- func (self *FuncService) RegisterPost(path string, handler gin.HandlerFunc)
- func (self *FuncService) RegisterPostRes(path string, handler gin.HandlerFunc, checkRes ...string)
- func (self *FuncService) RegisterPut(path string, handler gin.HandlerFunc)
- func (self *FuncService) RegisterRoute(gingrp *gin.RouterGroup)
- func (self *FuncService) RegisterRouter(method webserver.HttpMethod, path string, handler gin.HandlerFunc)
- func (self *FuncService) RegisterRouterErp(method webserver.HttpMethod, path string, handler gin.HandlerFunc, ...)
- func (self *FuncService) RegisterRouterMethod()
- func (self *FuncService) RegisterRouterRes(method webserver.HttpMethod, path string, handler gin.HandlerFunc, ...)
- func (self *FuncService) RegisterRouterStore(method webserver.HttpMethod, path string, handler gin.HandlerFunc, ...)
- func (self *FuncService) ResultJson(c *gin.Context, dto *basedto.IchubResult)
- func (self *FuncService) SessionToken2Context(ctx *gin.Context) context.Context
- func (self *FuncService) Set(ctx *gin.Context, key string, value any)
- func (self *FuncService) SetUserId(ctx *gin.Context)
- func (self *FuncService) WebCheckAllowed(ctx *gin.Context)
- type FuncServiceRes
- type FuncWeb
- type IFuncService
Constants ¶
This section is empty.
Variables ¶
View Source
var Fclose = func(ctx *gin.Context) { if err := ctx.Request.Body.Close(); err != nil { logrus.Errorf("failed to close: %v\n", err) } }
View Source
var FuncServiceMap = make(map[string]IFuncService)
Functions ¶
func Build ¶
func Build() *webserver.WebHandlers
func Register ¶
func Register(funcId string, funcService IFuncService)
Types ¶
type FuncCtxHandler ¶
type FuncService ¶
type FuncService struct {
Fclose FuncCtxHandler `json:"-"`
IFuncService IFuncService `json:"-"`
*FuncServiceRes
FuncId string `json:"func_id"`
RelativePath string `json:"relative_path"`
Handler gin.HandlerFunc `json:"-"`
IfMock bool `json:"if_mock"`
*webserver.WebHandlers `json:"-"`
}
func NewFuncService ¶
func NewFuncService() *FuncService
func (*FuncService) Check ¶
func (self *FuncService) Check()
func (*FuncService) CheckSessionToken ¶
func (self *FuncService) CheckSessionToken(ctx *gin.Context) gin.HandlerFunc
func (*FuncService) Execute ¶
func (self *FuncService) Execute(ctx *gin.Context)
func (*FuncService) FindNameOfIface ¶
func (self *FuncService) FindNameOfIface() string
func (*FuncService) GetFuncService ¶
func (self *FuncService) GetFuncService() *FuncService
func (*FuncService) GetParam2Bool ¶
func (self *FuncService) GetParam2Bool(c *gin.Context, key string) bool
func (*FuncService) GetParam2Int32 ¶
func (self *FuncService) GetParam2Int32(c *gin.Context, key string) int32
func (*FuncService) GetParam2Int64 ¶
func (self *FuncService) GetParam2Int64(c *gin.Context, key string) int64
func (*FuncService) GetParam2Str ¶
func (self *FuncService) GetParam2Str(c *gin.Context, key string) string
func (*FuncService) GetQuery2Bool ¶
func (self *FuncService) GetQuery2Bool(c *gin.Context, key string) bool
func (*FuncService) GetQuery2Int32 ¶
func (self *FuncService) GetQuery2Int32(c *gin.Context, key string) int32
func (*FuncService) GetQuery2Int64 ¶
func (self *FuncService) GetQuery2Int64(c *gin.Context, key string) int64
func (*FuncService) GetQuery2Str ¶
func (self *FuncService) GetQuery2Str(c *gin.Context, key string) string
func (*FuncService) GetSessionToken ¶
func (*FuncService) GetUserId ¶
func (self *FuncService) GetUserId(ctx *gin.Context) *webdto.WebUserId
func (*FuncService) GetUserIdErr ¶
func (*FuncService) HandleError ¶
func (self *FuncService) HandleError(c *gin.Context, err error)
func (*FuncService) IfWebHandlers ¶
func (self *FuncService) IfWebHandlers() bool
func (*FuncService) Init ¶
func (self *FuncService) Init(srv IFuncService)
func (*FuncService) InitRoute ¶
func (self *FuncService) InitRoute(ifuncservice IFuncService, method webserver.HttpMethod, path string)
single method will discard!
func (*FuncService) InitRouter ¶
func (self *FuncService) InitRouter(funcservice IFuncService, webGroupPath ...string)
func (*FuncService) Names ¶
func (self *FuncService) Names() string
func (*FuncService) NamesOf ¶
func (self *FuncService) NamesOf(some any) string
func (*FuncService) ParseBodyOnly ¶
func (self *FuncService) ParseBodyOnly(ctx *gin.Context, dto any) error
func (*FuncService) ParseResult ¶
func (self *FuncService) ParseResult(ctx *gin.Context, data interface{}) bool
func (*FuncService) Register ¶
func (self *FuncService) Register()
func (*FuncService) RegisterDelete ¶
func (self *FuncService) RegisterDelete(path string, handler gin.HandlerFunc)
func (*FuncService) RegisterGet ¶
func (self *FuncService) RegisterGet(path string, handler gin.HandlerFunc)
func (*FuncService) RegisterGetRes ¶
func (self *FuncService) RegisterGetRes(path string, handler gin.HandlerFunc, checkRes ...string)
func (*FuncService) RegisterPatch ¶
func (self *FuncService) RegisterPatch(path string, handler gin.HandlerFunc)
func (*FuncService) RegisterPost ¶
func (self *FuncService) RegisterPost(path string, handler gin.HandlerFunc)
func (*FuncService) RegisterPostRes ¶
func (self *FuncService) RegisterPostRes(path string, handler gin.HandlerFunc, checkRes ...string)
func (*FuncService) RegisterPut ¶
func (self *FuncService) RegisterPut(path string, handler gin.HandlerFunc)
func (*FuncService) RegisterRoute ¶
func (self *FuncService) RegisterRoute(gingrp *gin.RouterGroup)
func (*FuncService) RegisterRouter ¶
func (self *FuncService) RegisterRouter(method webserver.HttpMethod, path string, handler gin.HandlerFunc)
不需要授权,不注入表中,注入内存中 ResourceType,ResourceDomain,ResourceCode,ResourceKey,ActionKey
func (*FuncService) RegisterRouterErp ¶
func (self *FuncService) RegisterRouterErp(method webserver.HttpMethod, path string, handler gin.HandlerFunc, checkRes ...string)
func (*FuncService) RegisterRouterMethod ¶
func (self *FuncService) RegisterRouterMethod()
func (*FuncService) RegisterRouterRes ¶
func (self *FuncService) RegisterRouterRes(method webserver.HttpMethod, path string, handler gin.HandlerFunc, checkRes ...string)
注册 需要权限授权的资源,会自动注入表中 ResourceType,ResourceDomain,ResourceCode,ResourceKey,ActionKey
func (*FuncService) RegisterRouterStore ¶
func (self *FuncService) RegisterRouterStore(method webserver.HttpMethod, path string, handler gin.HandlerFunc, checkRes ...string)
func (*FuncService) ResultJson ¶
func (self *FuncService) ResultJson(c *gin.Context, dto *basedto.IchubResult)
func (*FuncService) SessionToken2Context ¶
func (self *FuncService) SessionToken2Context(ctx *gin.Context) context.Context
func (*FuncService) SetUserId ¶
func (self *FuncService) SetUserId(ctx *gin.Context)
func (*FuncService) WebCheckAllowed ¶
func (self *FuncService) WebCheckAllowed(ctx *gin.Context)
type FuncServiceRes ¶
type FuncServiceRes struct {
*webdto.WebContext
Name string
CheckRight bool `json:"check_right"`
WebGroupPath string `json:"web_group_path"`
Method webserver.HttpMethod `json:"method"`
Path string
Res string
}
func NewFuncServiceRes ¶
func NewFuncServiceRes() *FuncServiceRes
func (*FuncServiceRes) CheckRes ¶
func (selfg *FuncServiceRes) CheckRes() bool
func (*FuncServiceRes) SaveRes2Db ¶
func (selfg *FuncServiceRes) SaveRes2Db()
func (*FuncServiceRes) Single ¶
func (selfg *FuncServiceRes) Single() bool
type FuncWeb ¶
type FuncWeb = FuncService
type IFuncService ¶
type IFuncService interface {
Register()
InitRouter(funcservice IFuncService, webGroupPath ...string)
RegisterRouter(method webserver.HttpMethod, path string, handler gin.HandlerFunc)
RegisterRouterRes(method webserver.HttpMethod, path string, handler gin.HandlerFunc, checkRes ...string)
RegisterRouterErp(method webserver.HttpMethod, path string, handler gin.HandlerFunc, checkRes ...string)
RegisterRouterStore(method webserver.HttpMethod, path string, handler gin.HandlerFunc, checkRes ...string)
Check()
GetFuncService() *FuncService
Execute(c *gin.Context)
ExeFunc(c *gin.Context) (any, error)
}
func Find ¶
func Find(funcId string) IFuncService
Click to show internal directories.
Click to hide internal directories.