Documentation
¶
Index ¶
- func AddUserIdFilterIfNeed(filter map[string]interface{}, entity interface{}, ctx iris.Context)
- func FilterMustIsCurrentUserId(entity interface{}, ctx iris.Context) bool
- func GetBatchRequestPayload(ctx iris.Context) (payload entity.BatchRequestPayload, err error)
- func GetDefaultPagination() (p *entity.Pagination)
- func GetEntityService[T mongodbr.IEntity]() entity.IEntityService[T]
- func GetPagination(ctx iris.Context) (p *entity.Pagination, err error)
- func GetUserId(ctx iris.Context) string
- func MustGetPagination(ctx iris.Context) (p *entity.Pagination)
- func SetBaseServiceContext(context *BaseServiceContext, c *gin.Context)
- type BaseClaims
- type BaseControllerOptions
- type BaseEntityControllerOption
- func BaseEntityControllerWithAllDisabled(v bool) BaseEntityControllerOption
- func BaseEntityControllerWithAllEndpointDisabled(v bool) BaseEntityControllerOption
- func BaseEntityControllerWithAuthenticatedDisabled(v bool) BaseEntityControllerOption
- func BaseEntityControllerWithCreateDisabled(v bool) BaseEntityControllerOption
- func BaseEntityControllerWithDeleteDisabled(v bool) BaseEntityControllerOption
- func BaseEntityControllerWithDeleteListDisabled(v bool) BaseEntityControllerOption
- func BaseEntityControllerWithGetByIdDisabled(v bool) BaseEntityControllerOption
- func BaseEntityControllerWithListDisabled(v bool) BaseEntityControllerOption
- func BaseEntityControllerWithUpdateDisabled(v bool) BaseEntityControllerOption
- type BaseEntityControllerOptions
- type BaseServiceContext
- type Configurator
- type CustomClaims
- type EntityController
- func (c *EntityController[T]) All(ctx iris.Context)
- func (c *EntityController[T]) Create(ctx iris.Context)
- func (c *EntityController[T]) Delete(ctx iris.Context)
- func (c *EntityController[T]) DeleteList(ctx iris.Context)
- func (c *EntityController[T]) GetById(ctx iris.Context)
- func (c *EntityController[T]) GetEntityService() entity.IEntityService[T]
- func (c *EntityController[T]) GetList(ctx iris.Context)
- func (c *EntityController[T]) MergeAuthenticatedContextIfNeed(authenticatedDisabled bool, handlers ...context.Handler) []context.Handler
- func (c *EntityController[T]) RegistRouter(webapp *IrisApplication, opts ...BaseEntityControllerOption) router.Party
- func (c *EntityController[T]) SetUserInfo(ctx iris.Context, entityValue interface{})
- func (c *EntityController[T]) Update(ctx iris.Context)
- type IrisApplication
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddUserIdFilterIfNeed ¶
func AddUserIdFilterIfNeed(filter map[string]interface{}, entity interface{}, ctx iris.Context)
func FilterMustIsCurrentUserId ¶
func FilterMustIsCurrentUserId(entity interface{}, ctx iris.Context) bool
func GetBatchRequestPayload ¶
func GetBatchRequestPayload(ctx iris.Context) (payload entity.BatchRequestPayload, err error)
func GetDefaultPagination ¶
func GetDefaultPagination() (p *entity.Pagination)
func GetEntityService ¶
func GetEntityService[T mongodbr.IEntity]() entity.IEntityService[T]
func GetPagination ¶
func GetPagination(ctx iris.Context) (p *entity.Pagination, err error)
func MustGetPagination ¶
func MustGetPagination(ctx iris.Context) (p *entity.Pagination)
func SetBaseServiceContext ¶
func SetBaseServiceContext(context *BaseServiceContext, c *gin.Context)
Types ¶
type BaseClaims ¶
type BaseClaims struct {
UUID uuid.UUID
ID uint
Username string
TenantId uuid.UUID // 租户id,一般为companyId,uniweb中新增用户与casdoorId相同
NickName string
AuthorityId string
CasClaim *casdoorsdk.Claims
Role string // admin / normal
}
user Custom claims struct
type BaseControllerOptions ¶
type BaseControllerOptions struct {
AuthenticatedDisabled bool
}
type BaseEntityControllerOption ¶
type BaseEntityControllerOption func(*BaseEntityControllerOptions)
func BaseEntityControllerWithAllDisabled ¶
func BaseEntityControllerWithAllDisabled(v bool) BaseEntityControllerOption
func BaseEntityControllerWithAllEndpointDisabled ¶
func BaseEntityControllerWithAllEndpointDisabled(v bool) BaseEntityControllerOption
func BaseEntityControllerWithAuthenticatedDisabled ¶
func BaseEntityControllerWithAuthenticatedDisabled(v bool) BaseEntityControllerOption
func BaseEntityControllerWithCreateDisabled ¶
func BaseEntityControllerWithCreateDisabled(v bool) BaseEntityControllerOption
func BaseEntityControllerWithDeleteDisabled ¶
func BaseEntityControllerWithDeleteDisabled(v bool) BaseEntityControllerOption
func BaseEntityControllerWithDeleteListDisabled ¶
func BaseEntityControllerWithDeleteListDisabled(v bool) BaseEntityControllerOption
func BaseEntityControllerWithGetByIdDisabled ¶
func BaseEntityControllerWithGetByIdDisabled(v bool) BaseEntityControllerOption
func BaseEntityControllerWithListDisabled ¶
func BaseEntityControllerWithListDisabled(v bool) BaseEntityControllerOption
func BaseEntityControllerWithUpdateDisabled ¶
func BaseEntityControllerWithUpdateDisabled(v bool) BaseEntityControllerOption
type BaseEntityControllerOptions ¶
type BaseEntityControllerOptions struct {
AllDisabled bool
ListDisabled bool
GetByIdDisabled bool
CreateDisabled bool
UpdateDisabled bool
DeleteDisabled bool
DeleteListDisabled bool
ListFilterFunc func(entityType interface{}, filter map[string]interface{}, ctx iris.Context)
FilterCurrentUserForListDisabled bool
BaseControllerOptions
}
type BaseServiceContext ¶
type BaseServiceContext struct {
//当前用户信息
CurrentUserInfo CustomClaims
}
请求上下文数据
type Configurator ¶
type Configurator func(*IrisApplication)
type CustomClaims ¶
type CustomClaims struct {
BaseClaims
BufferTime int64
jwt.StandardClaims
}
type EntityController ¶
type EntityController[T mongodbr.IEntity] struct { RouterPath string EntityService entity.IEntityService[T] Options BaseEntityControllerOptions // contains filtered or unexported fields }
func (*EntityController[T]) All ¶
func (c *EntityController[T]) All(ctx iris.Context)
func (*EntityController[T]) DeleteList ¶
func (c *EntityController[T]) DeleteList(ctx iris.Context)
delete
func (*EntityController[T]) GetById ¶
func (c *EntityController[T]) GetById(ctx iris.Context)
get by id
func (*EntityController[T]) GetEntityService ¶
func (c *EntityController[T]) GetEntityService() entity.IEntityService[T]
func (*EntityController[T]) GetList ¶
func (c *EntityController[T]) GetList(ctx iris.Context)
func (*EntityController[T]) MergeAuthenticatedContextIfNeed ¶
func (*EntityController[T]) RegistRouter ¶
func (c *EntityController[T]) RegistRouter(webapp *IrisApplication, opts ...BaseEntityControllerOption) router.Party
func (*EntityController[T]) SetUserInfo ¶
func (c *EntityController[T]) SetUserInfo(ctx iris.Context, entityValue interface{})
type IrisApplication ¶
type IrisApplication struct {
*iris.Application
Address string
Err error
// contains filtered or unexported fields
}
func NewIrisApplication ¶
func NewIrisApplication() *IrisApplication
func (*IrisApplication) Build ¶
func (a *IrisApplication) Build(configurators ...Configurator) *IrisApplication
build IrisApplication environments
func (*IrisApplication) Configure ¶
func (a *IrisApplication) Configure(configurators ...Configurator) *IrisApplication
func (*IrisApplication) Run ¶
func (a *IrisApplication) Run(configurators ...Configurator) *IrisApplication
Source Files
¶
Click to show internal directories.
Click to hide internal directories.