Documentation ¶
Index ¶
- Variables
- func GetJSONSerializer() jsoniter.API
- func HandleError(err error) commons.Result
- func NewRecover(log zerolog.Logger) context.Handler
- func OK(data interface{}) commons.Result
- type Contextx
- func (c *Contextx) Error(err error) error
- func (c *Contextx) ErrorParam(err error) error
- func (c *Contextx) ErrorService(err error) error
- func (c *Contextx) Fail(message string, state, httpStatus int) error
- func (c *Contextx) FailInternal(message string, state int) error
- func (c *Contextx) FailParams(fieldErrors map[string]string) error
- func (c *Contextx) FailService(message string, state int) error
- func (c *Contextx) Finish(data interface{}, err error) error
- func (c *Contextx) GetIP() string
- func (c *Contextx) GetUID() string
- func (c *Contextx) IsLogined() bool
- func (c *Contextx) JSON(v interface{}) error
- func (c *Contextx) OK(data interface{}) error
- func (c *Contextx) Page(items interface{}, pageIndex, pageSize int, total int64, err error) error
- func (c *Contextx) ReadForm(formObject interface{}) error
- func (c *Contextx) ReadJSON(outPtr interface{}) error
- func (c *Contextx) ReadQuery(ptr interface{}) error
- type RbacClaims
- type RbacMiddleware
- type Verifier
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func GetJSONSerializer ¶
func HandleError ¶
Types ¶
type Contextx ¶
type Contextx struct {
iris.Context
}
func (*Contextx) ErrorParam ¶
request parameter error
func (*Contextx) ErrorService ¶
bussiness logic error
func (*Contextx) FailInternal ¶ added in v0.0.2
server internal error
func (*Contextx) FailParams ¶ added in v0.0.2
request parameter error
func (*Contextx) FailService ¶ added in v0.0.2
bussiness logic error
type RbacClaims ¶
type RbacClaims struct { jwt.Claims // roles seperate by space. e.g., "USER ADMIN" Roles string `json:"roles,omitempty"` }
subject(sub) is user id
type RbacMiddleware ¶
type RbacMiddleware struct {
// contains filtered or unexported fields
}
func NewRbacMiddleware ¶
func NewRbacMiddleware(roles ...string) *RbacMiddleware
func (*RbacMiddleware) Middleware ¶
func (s *RbacMiddleware) Middleware(ctx iris.Context)
type Verifier ¶
type Verifier struct {
// contains filtered or unexported fields
}
func NewVerifier ¶
NewVerifier please use ECDSA alg
func (*Verifier) GetVerifier ¶
func (*Verifier) Middleware ¶
func (v *Verifier) Middleware(validators ...jwt.TokenValidator) context.Handler
func (*Verifier) SetBlockList ¶
Click to show internal directories.
Click to hide internal directories.