task

package
v2.3.38 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2024 License: MIT Imports: 23 Imported by: 0

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
}

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