task

package
v2.3.42 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2025 License: MIT Imports: 24 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 Export

func Export[T, C, N any](ctx context.Context, data []byte, emptyListError error, listFn func(context.Context, N) ([]T, error), actionFn func(T) (C, error)) (*model.Message, error)

func Import

func Import[T, C any, D string | int](ctx context.Context, data []byte, dataFn func(T) []C, actionFn func(context.Context, T, C) (D, error, error)) (*model.Message, error)

func MassDelete

func MassDelete[T any, C string | int](ctx context.Context, data []byte, notFoundError error, idsFn func(T) []C, pluckIDsFn func(context.Context, []C) ([]C, error), actionFn func(context.Context, T, C) error) (*model.Message, error)

func MassUpdate

func MassUpdate[T any, C string | int](ctx context.Context, data []byte, notFoundError error, idsFn func(T) []C, pluckIDsFn func(context.Context, []C) ([]C, error), actionFn func(context.Context, C, T) error) (*model.Message, error)

Types

type Config

type Config struct {
	Debug       string
	DB          *gorm.DB
	Transaction mw.ITransaction
	Services    Consumers
	TokenString string
	SseSvc      sse.SSE
}

type Consumer

type Consumer interface {
	service.Consumer
}

type Consumers

type Consumers map[string]Consumer

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)

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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