controllerx

package
v0.0.0-...-f71ac91 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 26, 2025 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Index

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 GetUserId

func GetUserId(ctx iris.Context) string

Iris operations

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
}

func GetClaims

func GetClaims(c *gin.Context) (*CustomClaims, error)

Gin operations

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]) Create

func (c *EntityController[T]) Create(ctx iris.Context)

create

func (*EntityController[T]) Delete

func (c *EntityController[T]) Delete(ctx iris.Context)

delete

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 (c *EntityController[T]) MergeAuthenticatedContextIfNeed(authenticatedDisabled bool, handlers ...context.Handler) []context.Handler

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{})

func (*EntityController[T]) Update

func (c *EntityController[T]) Update(ctx iris.Context)

update

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

Directories

Path Synopsis
debuger
middleware
err

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL