Documentation ¶
Index ¶
- Constants
- Variables
- func ErrorHandler(c *fiber.Ctx, err error) error
- func NewAdminContext(opts ...AdminContextOption) fiber.Handler
- func NewRequestContext() func(c *fiber.Ctx) (err error)
- func StartTime(ctx context.Context) time.Time
- type AdminContext
- type AdminContextKey
- type AdminContextOption
- type RequestContext
- type RequestContextKey
- type RequestContextOption
Constants ¶
View Source
const (
RoleNameSuperAdmin = "SUPER_ADMIN"
)
Variables ¶
View Source
var IsProduction bool
Functions ¶
func NewAdminContext ¶
func NewAdminContext(opts ...AdminContextOption) fiber.Handler
a context help handling error
func NewRequestContext ¶
func NewRequestContext() func(c *fiber.Ctx) (err error)
a context help handling error
Types ¶
type AdminContext ¶
type AdminContext struct { context.Context Admin *ent.Admin // contains filtered or unexported fields }
func GetAdminContext ¶
func GetAdminContext(ctx context.Context) (*AdminContext, error)
func MustAdminContext ¶
func MustAdminContext(ctx context.Context) *AdminContext
func (*AdminContext) IsSuperAdmin ¶
func (ctx *AdminContext) IsSuperAdmin() bool
func (*AdminContext) PermissionNames ¶
func (ctx *AdminContext) PermissionNames() []string
func (*AdminContext) Permissions ¶
func (ctx *AdminContext) Permissions() []*ent.Permission
func (*AdminContext) RoleNames ¶
func (ctx *AdminContext) RoleNames() []string
func (*AdminContext) Roles ¶
func (ctx *AdminContext) Roles() []*ent.Role
type AdminContextKey ¶
type AdminContextKey struct{}
type AdminContextOption ¶
type AdminContextOption func(*AdminContext)
func WithAdmin ¶
func WithAdmin(admin *ent.Admin) AdminContextOption
type RequestContext ¶
func GetRequestContext ¶
func GetRequestContext(ctx context.Context) (*RequestContext, error)
func MustRequestContext ¶
func MustRequestContext(ctx context.Context) *RequestContext
func SetRequestStatus ¶
func SetRequestStatus(ctx context.Context, errorCode int, httpCode int) *RequestContext
func (*RequestContext) PrintLog ¶
func (ctx *RequestContext) PrintLog()
type RequestContextKey ¶
type RequestContextKey struct{}
type RequestContextOption ¶
type RequestContextOption func(*RequestContext)
Click to show internal directories.
Click to hide internal directories.