task

package
v2.3.131 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2025 License: MIT Imports: 31 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateFile added in v2.3.100

func CreateFile(fileName string) (*os.File, string, error)

func Export

func Export[T, C, N any](ctx context.Context, taskID int, msgChan chan<- *model.Message, data []byte, emptyListError error, checkDataFn CheckDataFn[N], listFn ListFn[T, N], actionFn ExportActionFn[T, C]) (*model.Message, error)

func Import

func Import[T, C any, D string | int](ctx context.Context, taskID int, msgChan chan<- *model.Message, data []byte, checkDataFn CheckDataFn[T], dataFn DataFn[T, C], actionFn ImportActionFn[T, C, D]) (*model.Message, error)

func MassDelete

func MassDelete[T any, C string | int](ctx context.Context, taskID int, msgChan chan<- *model.Message, data []byte, notFoundError error, checkDataFn CheckDataFn[T], idsFn IdsFn[T, C], pluckIDsFn PluckIDsFn[C], actionFn DeleteActionFn[T, C]) (*model.Message, error)

func MassUpdate

func MassUpdate[T any, C string | int](ctx context.Context, taskID int, msgChan chan<- *model.Message, data []byte, notFoundError error, checkDataFn CheckDataFn[T], idsFn IdsFn[T, C], pluckIDsFn PluckIDsFn[C], actionFn UpdateActionFn[T, C]) (*model.Message, error)

Types

type CheckDataFn added in v2.3.74

type CheckDataFn[T any] func(T) error

type Config

type Config struct {
	Debug       string
	DB          *gorm.DB
	Transaction mw.ITransaction
	Services    Consumers
	TokenString string
	WS          websocket.WebSocket
}

type Consumer

type Consumer interface {
	service.Consumer
}

type Consumers

type Consumers map[string]Consumer

type DataFn added in v2.3.74

type DataFn[T, C any] func(T) []C

type DeleteActionFn added in v2.3.74

type DeleteActionFn[T any, C string | int] func(context.Context, T, C) error

type ExportActionFn added in v2.3.74

type ExportActionFn[T, C any] func(T) (C, error)

type IdsFn added in v2.3.74

type IdsFn[T any, C string | int] func(T) []C

type ImportActionFn added in v2.3.74

type ImportActionFn[T, C any, D string | int] func(context.Context, T, C) (D, error, error)

type ListFn added in v2.3.74

type ListFn[T, N any] func(context.Context, N) ([]T, error)

type PluckIDsFn added in v2.3.74

type PluckIDsFn[C string | int] func(context.Context, []C) ([]C, error)

type Queue

type Queue interface {
	Run(data runner.Data)
	Stop(id int)
	TaskResults() chan runner.TaskResult
}

type Task

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

func (*Task) ExportHandler

func (e *Task) ExportHandler(name string, bind func(c *gin.Context) ([]byte, error)) gin.HandlerFunc

func (*Task) ImportHandler

func (e *Task) ImportHandler(name string, bind func(c *gin.Context) ([]byte, error)) gin.HandlerFunc

func (*Task) InitHandler

func (e *Task) InitHandler(secured *gin.RouterGroup, unsecured *gin.RouterGroup)

func (*Task) MassDeleteHandler

func (e *Task) MassDeleteHandler(name string, bind func(c *gin.Context) ([]byte, error)) gin.HandlerFunc

func (*Task) MassUpdateHandler

func (e *Task) MassUpdateHandler(name string, bind func(c *gin.Context) ([]byte, error)) gin.HandlerFunc

func (*Task) NewTask

func (e *Task) NewTask(c *gin.Context, tp string, name string, data []byte) (*model.Task, error)

type Tasker

type Tasker interface {
	InitHandler(secured *gin.RouterGroup, unsecured *gin.RouterGroup)
	ExportHandler(name string, bind func(c *gin.Context) ([]byte, error)) gin.HandlerFunc
	ImportHandler(name string, bind func(c *gin.Context) ([]byte, error)) gin.HandlerFunc
	MassUpdateHandler(name string, bind func(c *gin.Context) ([]byte, error)) gin.HandlerFunc
	MassDeleteHandler(name string, bind func(c *gin.Context) ([]byte, error)) gin.HandlerFunc
}

func NewTask

func NewTask(ctx context.Context, cfg Config) (Tasker, error)

type UpdateActionFn added in v2.3.74

type UpdateActionFn[T any, C string | int] func(context.Context, C, T) error

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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