models

package
v0.0.0-...-36f034f Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type M

type M map[string]interface{}

M m

func (*M) Scan

func (p *M) Scan(data interface{}) error

Scan Scan

func (*M) Unmarshal

func (p *M) Unmarshal(pointer interface{}) error

Unmarshal Unmarshal M to struct pointer

func (M) Value

func (p M) Value() (driver.Value, error)

Value Value

type PubSub

type PubSub struct {
	UserID string
	UUID   string
	Topic  string
	Key    string
}

PubSub PubSub

type PubSubRepo

type PubSubRepo interface {
	Subscribe(ctx context.Context, pubsub *PubSub, ttl time.Duration) error

	Get(ctx context.Context, topic, key string) ([]*PubSub, error)
}

PubSubRepo PubSubRepo

type Task

type Task struct {
	ID          string
	CreatedAt   int64
	FinishAt    int64
	CreatorID   string
	CreatorName string
	Title       string
	Types       string
	Command     string
	FileAddr    string
	FileSize    int
	FileOpt     string
	Value       M
	Result      M
	Status      TaskStatus
	Ratio       float64
	DepID       string `gorm:"-"`
}

Task task list

type TaskRepo

type TaskRepo interface {
	Create(*gorm.DB, *Task) error
	List(*gorm.DB, string, string, int, int, int) ([]*Task, int64, error)
	FinishTask(*gorm.DB, *Task) error
	ChangeRatio(db *gorm.DB, task *Task) error
	GetByID(db *gorm.DB, taskID string) (*Task, error)
	GetProcessing(db *gorm.DB, id string, types string) (int64, error)
	DeleteByID(db *gorm.DB, id string) error
	GetByCondition(db *gorm.DB, task *Task) (*Task, error)

	ListProcessing(db *gorm.DB) ([]*Task, error)
}

TaskRepo TaskRepo

type TaskStatus

type TaskStatus int

TaskStatus TaskStatus

const (
	// TaskSuccess TaskSuccess
	TaskSuccess TaskStatus = 2
	// TaskFail TaskFail
	TaskFail TaskStatus = 3
	//TaskDoing TaskDoing
	TaskDoing TaskStatus = 1
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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