controllers

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2023 License: Apache-2.0 Imports: 60 Imported by: 4

Documentation

Index

Constants

View Source
const (
	ControllerIdNode = iota << 1
	ControllerIdProject
	ControllerIdSpider
	ControllerIdTask
	ControllerIdJob
	ControllerIdSchedule
	ControllerIdUser
	ControllerIdSetting
	ControllerIdToken
	ControllerIdVariable
	ControllerIdTag
	ControllerIdLogin
	ControllerIdColor
	ControllerIdPlugin
	ControllerIdDataSource
	ControllerIdDataCollection
	ControllerIdResult
	ControllerIdStats
	ControllerIdFiler
	ControllerIdPluginDo
	ControllerIdGit
	ControllerIdRole
	ControllerIdPermission
	ControllerIdExport
	ControllerIdEnvDeps
	ControllerIdNotification
	ControllerIdFilter
	ControllerIdEnvironment

	ControllerIdVersion
	ControllerIdI18n
	ControllerIdSystemInfo
	ControllerIdDemo
)

Variables

View Source
var DataCollectionController *dataCollectionController
View Source
var DataSourceController *dataSourceController
View Source
var EnvironmentActions []Action
View Source
var EnvironmentController *environmentController
View Source
var NodeController *nodeController
View Source
var PluginController *pluginController
View Source
var ProjectController *projectController
View Source
var ScheduleController *scheduleController
View Source
var SettingController *settingController
View Source
var SpiderController *spiderController
View Source
var TaskController *taskController
View Source
var TokenActions []Action
View Source
var TokenController *tokenController
View Source
var UserController *userController

Functions

func GetColorList

func GetColorList(c *gin.Context)

func GetDefaultPagination

func GetDefaultPagination() (p *entity.Pagination)

func GetFilter

func GetFilter(c *gin.Context) (f *entity.Filter, err error)

GetFilter Get entity.Filter from gin.Context

func GetFilterAll

func GetFilterAll(c *gin.Context) (res bool, err error)

GetFilterAll Get all from gin.Context

func GetFilterQuery

func GetFilterQuery(c *gin.Context) (q bson.M, err error)

GetFilterQuery Get bson.M from gin.Context

func GetPagination

func GetPagination(c *gin.Context) (p *entity.Pagination, err error)

func GetSorts

func GetSorts(c *gin.Context) (sorts []entity.Sort, err error)

GetSorts Get entity.Sort from gin.Context

func GetSortsOption

func GetSortsOption(c *gin.Context) (sort bson.D, err error)

GetSortsOption Get entity.Sort from gin.Context

func GetUserFromContext

func GetUserFromContext(c *gin.Context) (u interfaces.User)

func GetVersion

func GetVersion(c *gin.Context)

func HandleError

func HandleError(statusCode int, c *gin.Context, err error)

func HandleErrorBadRequest

func HandleErrorBadRequest(c *gin.Context, err error)

func HandleErrorInternalServerError

func HandleErrorInternalServerError(c *gin.Context, err error)

func HandleErrorNoPrint

func HandleErrorNoPrint(statusCode int, c *gin.Context, err error)

func HandleErrorNotFound

func HandleErrorNotFound(c *gin.Context, err error)

func HandleErrorNotFoundNoPrint

func HandleErrorNotFoundNoPrint(c *gin.Context, err error)

func HandleErrorUnauthorized

func HandleErrorUnauthorized(c *gin.Context, err error)

func HandleSuccess

func HandleSuccess(c *gin.Context)

func HandleSuccessWithData

func HandleSuccessWithData(c *gin.Context, data interface{})

func HandleSuccessWithListData

func HandleSuccessWithListData(c *gin.Context, data interface{}, total int)

func InitControllers

func InitControllers() (err error)

func MustGetFilterAll

func MustGetFilterAll(c *gin.Context) (res bool)

func MustGetFilterQuery

func MustGetFilterQuery(c *gin.Context) (q bson.M)

func MustGetPagination

func MustGetPagination(c *gin.Context) (p *entity.Pagination)

func MustGetSortOption

func MustGetSortOption(c *gin.Context) (sort bson.D)

func SortsToOption

func SortsToOption(sorts []entity.Sort) (sort bson.D, err error)

SortsToOption Translate entity.Sort to bson.D

Types

type Action

type Action struct {
	Method      string
	Path        string
	HandlerFunc gin.HandlerFunc
}

type ActionController

type ActionController interface {
	Actions() (actions []Action)
}
var ColorController ActionController
var DemoController ActionController
var EnvDepsController ActionController
var ExportController ActionController
var FilerController ActionController
var FilterController ActionController
var I18nController ActionController
var LoginController ActionController
var NotificationController ActionController
var PluginProxyController ActionController
var ResultController ActionController
var StatsController ActionController
var SystemInfoController ActionController
var VersionController ActionController

type ActionControllerDelegate

type ActionControllerDelegate struct {
	// contains filtered or unexported fields
}

func NewActionControllerDelegate

func NewActionControllerDelegate(id ControllerId, actions []Action) (d *ActionControllerDelegate)

func (*ActionControllerDelegate) Actions

func (ctr *ActionControllerDelegate) Actions() (actions []Action)

type BasicController

type BasicController interface {
	Get(c *gin.Context)
	Post(c *gin.Context)
	Put(c *gin.Context)
	Delete(c *gin.Context)
}

type BasicControllerDelegate

type BasicControllerDelegate struct {
	// contains filtered or unexported fields
}

func (*BasicControllerDelegate) Delete

func (d *BasicControllerDelegate) Delete(c *gin.Context)

func (*BasicControllerDelegate) Get

func (d *BasicControllerDelegate) Get(c *gin.Context)

func (*BasicControllerDelegate) Post

func (d *BasicControllerDelegate) Post(c *gin.Context)

func (*BasicControllerDelegate) Put

func (d *BasicControllerDelegate) Put(c *gin.Context)

type BinderInterface

type BinderInterface interface {
	Bind(c *gin.Context) (res interfaces.Model, err error)
	BindList(c *gin.Context) (res []interfaces.Model, err error)
	BindBatchRequestPayload(c *gin.Context) (payload entity.BatchRequestPayload, err error)
	BindBatchRequestPayloadWithStringData(c *gin.Context) (payload entity.BatchRequestPayloadWithStringData, res interfaces.Model, err error)
}

type ControllerId

type ControllerId int

type JsonBinder

type JsonBinder struct {
	// contains filtered or unexported fields
}

func NewJsonBinder

func NewJsonBinder(id ControllerId) (b *JsonBinder)

func (*JsonBinder) Bind

func (b *JsonBinder) Bind(c *gin.Context) (res interfaces.Model, err error)

func (*JsonBinder) BindBatchRequestPayload

func (b *JsonBinder) BindBatchRequestPayload(c *gin.Context) (payload entity.BatchRequestPayload, err error)

func (*JsonBinder) BindBatchRequestPayloadWithStringData

func (b *JsonBinder) BindBatchRequestPayloadWithStringData(c *gin.Context) (payload entity.BatchRequestPayloadWithStringData, res interfaces.Model, err error)

func (*JsonBinder) BindList

func (b *JsonBinder) BindList(c *gin.Context) (res interface{}, err error)

type ListActionController

type ListActionController interface {
	ListController
	ActionController
}

type ListActionControllerDelegate

type ListActionControllerDelegate struct {
	ListController
	ActionController
}

func NewListPostActionControllerDelegate

func NewListPostActionControllerDelegate(id ControllerId, svc interfaces.ModelBaseService, actions []Action) (d *ListActionControllerDelegate)

type ListController

type ListController interface {
	BasicController
	GetList(c *gin.Context)
	PutList(c *gin.Context)
	PostList(c *gin.Context)
	DeleteList(c *gin.Context)
}
var GitController ListController
var PermissionController ListController
var RoleController ListController
var TagController ListController

type ListControllerDelegate

type ListControllerDelegate struct {
	// contains filtered or unexported fields
}

func (*ListControllerDelegate) Delete

func (d *ListControllerDelegate) Delete(c *gin.Context)

func (*ListControllerDelegate) DeleteList

func (d *ListControllerDelegate) DeleteList(c *gin.Context)

func (*ListControllerDelegate) Get

func (d *ListControllerDelegate) Get(c *gin.Context)

func (*ListControllerDelegate) GetList

func (d *ListControllerDelegate) GetList(c *gin.Context)

func (*ListControllerDelegate) Post

func (d *ListControllerDelegate) Post(c *gin.Context)

func (*ListControllerDelegate) PostList

func (d *ListControllerDelegate) PostList(c *gin.Context)

func (*ListControllerDelegate) Put

func (d *ListControllerDelegate) Put(c *gin.Context)

func (*ListControllerDelegate) PutList

func (d *ListControllerDelegate) PutList(c *gin.Context)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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