controllerx

package
v0.0.0-...-418145e Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2024 License: Apache-2.0 Imports: 29 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

func MustGetPagination

func MustGetPagination(ctx iris.Context) (p *entity.Pagination)

Types

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 Configurator

type Configurator func(*IrisApplication)

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