Documentation ¶
Index ¶
- Constants
- Variables
- func FilterToQuery(f *entity.Filter) (q bson.M, err error)
- func GetColorList(c *gin.Context)
- func GetDefaultPagination() (p *entity.Pagination)
- func GetFilter(c *gin.Context) (f *entity.Filter, err error)
- func GetFilterAll(c *gin.Context) (res bool, err error)
- func GetFilterQuery(c *gin.Context) (q bson.M, err error)
- func GetPagination(c *gin.Context) (p *entity.Pagination, err error)
- func GetSorts(c *gin.Context) (sorts []entity.Sort, err error)
- func GetSortsOption(c *gin.Context) (sort bson.D, err error)
- func GetUserFromContext(c *gin.Context) (u interfaces.User)
- func GetVersion(c *gin.Context)
- func HandleError(statusCode int, c *gin.Context, err error)
- func HandleErrorBadRequest(c *gin.Context, err error)
- func HandleErrorInternalServerError(c *gin.Context, err error)
- func HandleErrorNoPrint(statusCode int, c *gin.Context, err error)
- func HandleErrorNotFound(c *gin.Context, err error)
- func HandleErrorNotFoundNoPrint(c *gin.Context, err error)
- func HandleErrorUnauthorized(c *gin.Context, err error)
- func HandleSuccess(c *gin.Context)
- func HandleSuccessWithData(c *gin.Context, data interface{})
- func HandleSuccessWithListData(c *gin.Context, data interface{}, total int)
- func InitControllers() (err error)
- func MustGetFilterAll(c *gin.Context) (res bool)
- func MustGetFilterQuery(c *gin.Context) (q bson.M)
- func MustGetPagination(c *gin.Context) (p *entity.Pagination)
- func MustGetSortOption(c *gin.Context) (sort bson.D)
- func OptionUnauthorized(c *gin.Context, err error)
- func SortsToOption(sorts []entity.Sort) (sort bson.D, err error)
- type Action
- type ActionController
- type ActionControllerDelegate
- type BasicController
- type BasicControllerDelegate
- type BinderInterface
- type ControllerId
- type JsonBinder
- func (b *JsonBinder) Bind(c *gin.Context) (res interfaces.Model, err error)
- func (b *JsonBinder) BindBatchRequestPayload(c *gin.Context) (payload entity.BatchRequestPayload, err error)
- func (b *JsonBinder) BindBatchRequestPayloadWithStringData(c *gin.Context) (payload entity.BatchRequestPayloadWithStringData, res interfaces.Model, ...)
- func (b *JsonBinder) BindList(c *gin.Context) (res interface{}, err error)
- type ListActionController
- type ListActionControllerDelegate
- type ListController
- type ListControllerDelegate
- func (d *ListControllerDelegate) Delete(c *gin.Context)
- func (d *ListControllerDelegate) DeleteList(c *gin.Context)
- func (d *ListControllerDelegate) Get(c *gin.Context)
- func (d *ListControllerDelegate) GetList(c *gin.Context)
- func (d *ListControllerDelegate) Post(c *gin.Context)
- func (d *ListControllerDelegate) PostList(c *gin.Context)
- func (d *ListControllerDelegate) Put(c *gin.Context)
- func (d *ListControllerDelegate) PutList(c *gin.Context)
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 ¶
FilterToQuery Translate entity.Filter to bson.M
func GetColorList ¶
func GetDefaultPagination ¶
func GetDefaultPagination() (p *entity.Pagination)
func GetFilterAll ¶
GetFilterAll Get all from gin.Context
func GetFilterQuery ¶
GetFilterQuery Get bson.M from gin.Context
func GetPagination ¶
func GetPagination(c *gin.Context) (p *entity.Pagination, err error)
func GetSortsOption ¶
GetSortsOption Get entity.Sort from gin.Context
func GetUserFromContext ¶
func GetUserFromContext(c *gin.Context) (u interfaces.User)
func GetVersion ¶
func HandleErrorBadRequest ¶
func HandleErrorNotFound ¶
func HandleErrorUnauthorized ¶
func HandleSuccess ¶
func HandleSuccessWithData ¶
func InitControllers ¶
func InitControllers() (err error)
func MustGetFilterAll ¶
func MustGetPagination ¶
func MustGetPagination(c *gin.Context) (p *entity.Pagination)
func OptionUnauthorized ¶
Types ¶
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 BasicControllerDelegate ¶
type BasicControllerDelegate struct {
// contains filtered or unexported fields
}
func NewBasicControllerDelegate ¶
func NewBasicControllerDelegate(id ControllerId, svc interfaces.ModelBaseService) (d *BasicControllerDelegate)
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)
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 NewListControllerDelegate ¶
func NewListControllerDelegate(id ControllerId, svc interfaces.ModelBaseService) (d *ListControllerDelegate)
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)
Source Files ¶
- base.go
- binder.go
- binder_json.go
- color.go
- data_collection.go
- delegate_action.go
- delegate_basic.go
- delegate_list.go
- delegate_list_action.go
- filer.go
- git.go
- init.go
- login.go
- node.go
- plugin.go
- plugin_proxy.go
- project.go
- result.go
- schedule.go
- setting.go
- spider.go
- stats.go
- tag.go
- task.go
- token.go
- user.go
- utils_context.go
- utils_filter.go
- utils_http.go
- utils_pagination.go
- utils_sort.go
- version.go
Click to show internal directories.
Click to hide internal directories.