controllers

package
v0.0.0-...-0485310 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2024 License: Apache-2.0 Imports: 39 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteBaseFileFile

func DeleteBaseFileFile(rootPath string, c *gin.Context)

func DeleteList

func DeleteList(c *gin.Context)

func DeleteSpiderById

func DeleteSpiderById(c *gin.Context)

func DeleteSpiderFile

func DeleteSpiderFile(c *gin.Context)

func DeleteSpiderList

func DeleteSpiderList(c *gin.Context)

func DeleteTaskById

func DeleteTaskById(c *gin.Context)

func GetBaseFileFile

func GetBaseFileFile(rootPath string, c *gin.Context)

func GetBaseFileFileInfo

func GetBaseFileFileInfo(rootPath string, c *gin.Context)

func GetBaseFileFsSvc

func GetBaseFileFsSvc(rootPath string) (svc interfaces.FsServiceV2, err error)

func GetBaseFileListDir

func GetBaseFileListDir(rootPath string, c *gin.Context)

func GetDefaultPagination

func GetDefaultPagination() (p *entity.Pagination)

func GetExport

func GetExport(c *gin.Context)

func GetExportDownload

func GetExportDownload(c *gin.Context)

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 GetFilterColFieldOptions

func GetFilterColFieldOptions(c *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 GetProjectList

func GetProjectList(c *gin.Context)

func GetResultList

func GetResultList(c *gin.Context)

func GetSetting

func GetSetting(c *gin.Context)

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 GetSpiderById

func GetSpiderById(c *gin.Context)

func GetSpiderDataSource

func GetSpiderDataSource(c *gin.Context)

func GetSpiderFile

func GetSpiderFile(c *gin.Context)

func GetSpiderFileInfo

func GetSpiderFileInfo(c *gin.Context)

func GetSpiderList

func GetSpiderList(c *gin.Context)

func GetSpiderListDir

func GetSpiderListDir(c *gin.Context)

func GetStatsDaily

func GetStatsDaily(c *gin.Context)

func GetStatsOverview

func GetStatsOverview(c *gin.Context)

func GetStatsTasks

func GetStatsTasks(c *gin.Context)

func GetSyncDownload

func GetSyncDownload(c *gin.Context)

func GetSyncScan

func GetSyncScan(c *gin.Context)

func GetSystemInfo

func GetSystemInfo(c *gin.Context)

func GetTaskById

func GetTaskById(c *gin.Context)

func GetTaskData

func GetTaskData(c *gin.Context)

func GetTaskList

func GetTaskList(c *gin.Context)

func GetTaskLogs

func GetTaskLogs(c *gin.Context)

func GetUserFromContext

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

func GetUserFromContextV2

func GetUserFromContextV2(c *gin.Context) (u *models.UserV2)

func GetUserMe

func GetUserMe(c *gin.Context)

func HandleError

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

func HandleErrorBadRequest

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

func HandleErrorForbidden

func HandleErrorForbidden(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 InitRoutes

func InitRoutes(app *gin.Engine) (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 PostBaseFileCopyFile

func PostBaseFileCopyFile(rootPath string, c *gin.Context)

func PostBaseFileExport

func PostBaseFileExport(rootPath string, c *gin.Context)

func PostBaseFileRenameFile

func PostBaseFileRenameFile(rootPath string, c *gin.Context)

func PostBaseFileSaveDir

func PostBaseFileSaveDir(rootPath string, c *gin.Context)

func PostBaseFileSaveFile

func PostBaseFileSaveFile(rootPath string, c *gin.Context)

func PostBaseFileSaveFiles

func PostBaseFileSaveFiles(rootPath string, c *gin.Context)

func PostExport

func PostExport(c *gin.Context)

func PostLogin

func PostLogin(c *gin.Context)

func PostLogout

func PostLogout(c *gin.Context)

func PostSchedule

func PostSchedule(c *gin.Context)

func PostScheduleDisable

func PostScheduleDisable(c *gin.Context)

func PostScheduleEnable

func PostScheduleEnable(c *gin.Context)

func PostSetting

func PostSetting(c *gin.Context)

func PostSpider

func PostSpider(c *gin.Context)

func PostSpiderCopyFile

func PostSpiderCopyFile(c *gin.Context)

func PostSpiderDataSource

func PostSpiderDataSource(c *gin.Context)

func PostSpiderExport

func PostSpiderExport(c *gin.Context)

func PostSpiderRenameFile

func PostSpiderRenameFile(c *gin.Context)

func PostSpiderRun

func PostSpiderRun(c *gin.Context)

func PostSpiderSaveDir

func PostSpiderSaveDir(c *gin.Context)

func PostSpiderSaveFile

func PostSpiderSaveFile(c *gin.Context)

func PostSpiderSaveFiles

func PostSpiderSaveFiles(c *gin.Context)

func PostTaskCancel

func PostTaskCancel(c *gin.Context)

func PostTaskRestart

func PostTaskRestart(c *gin.Context)

func PostTaskRun

func PostTaskRun(c *gin.Context)

func PostToken

func PostToken(c *gin.Context)

func PostUser

func PostUser(c *gin.Context)

func PostUserChangePassword

func PostUserChangePassword(c *gin.Context)

func PutScheduleById

func PutScheduleById(c *gin.Context)

func PutSetting

func PutSetting(c *gin.Context)

func PutSpiderById

func PutSpiderById(c *gin.Context)

func PutUserById

func PutUserById(c *gin.Context)

func RegisterActions

func RegisterActions(group *gin.RouterGroup, basePath string, actions []Action)

func RegisterController

func RegisterController[T any](group *gin.RouterGroup, basePath string, ctr *BaseControllerV2[T])

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 BaseControllerV2

type BaseControllerV2[T any] struct {
	// contains filtered or unexported fields
}

func NewControllerV2

func NewControllerV2[T any](actions ...Action) *BaseControllerV2[T]

func (*BaseControllerV2[T]) DeleteById

func (ctr *BaseControllerV2[T]) DeleteById(c *gin.Context)

func (*BaseControllerV2[T]) DeleteList

func (ctr *BaseControllerV2[T]) DeleteList(c *gin.Context)

func (*BaseControllerV2[T]) GetById

func (ctr *BaseControllerV2[T]) GetById(c *gin.Context)

func (*BaseControllerV2[T]) GetList

func (ctr *BaseControllerV2[T]) GetList(c *gin.Context)

func (*BaseControllerV2[T]) PatchList

func (ctr *BaseControllerV2[T]) PatchList(c *gin.Context)

func (*BaseControllerV2[T]) Post

func (ctr *BaseControllerV2[T]) Post(c *gin.Context)

func (*BaseControllerV2[T]) PutById

func (ctr *BaseControllerV2[T]) PutById(c *gin.Context)

type ListResponse

type ListResponse[T any] struct {
	Status  string `json:"status"`
	Message string `json:"message"`
	Total   int    `json:"total"`
	Data    []T    `json:"data"`
	Error   string `json:"error"`
}

type Response

type Response[T any] struct {
	Status  string `json:"status"`
	Message string `json:"message"`
	Data    T      `json:"data"`
	Error   string `json:"error"`
}

type RouterGroups

type RouterGroups struct {
	AuthGroup      *gin.RouterGroup
	AnonymousGroup *gin.RouterGroup
}

func NewRouterGroups

func NewRouterGroups(app *gin.Engine) (groups *RouterGroups)

type WsWriter

type WsWriter struct {
	io.Writer
	io.Closer
	// contains filtered or unexported fields
}

func NewWsWriter

func NewWsWriter(c *gin.Context) (writer *WsWriter, err error)

func (*WsWriter) Close

func (w *WsWriter) Close() (err error)

func (*WsWriter) CloseWithError

func (w *WsWriter) CloseWithError(err error)

func (*WsWriter) CloseWithText

func (w *WsWriter) CloseWithText(text string)

func (*WsWriter) Write

func (w *WsWriter) Write(data []byte) (n int, err error)

Jump to

Keyboard shortcuts

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