controllers

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2022 License: BSD-3-Clause Imports: 49 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ControllerIdNode = iota
	ControllerIdProject
	ControllerIdSpider
	ControllerIdTask
	ControllerIdJob
	ControllerIdSchedule
	ControllerIdUser
	ControllerIdSetting
	ControllerIdToken
	ControllerIdVariable
	ControllerIdTag
	ControllerIdLogin
	ControllerIdColor
	ControllerIdPlugin
	ControllerIdDataSource
	ControllerIdDataCollection
	ControllerIdResult
	ControllerIdStats
	ControllerIdFiler
	ControllerIdPluginDo
	ControllerIdGit
	ControllerIdVersion
)

Variables

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 FilterToQuery

func FilterToQuery(f *entity.Filter) (q bson.M, err error)

FilterToQuery Translate entity.Filter to bson.M

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 OptionUnauthorized

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

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 FilerController ActionController
var LoginController ActionController
var PluginProxyController ActionController
var ResultController ActionController
var StatsController 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 DataCollectionController ListController
var GitController 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