model

package
v1.0.26 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalCostTime added in v1.0.26

func CalCostTime(c *CostTime) func()

func Callback added in v1.0.9

func Callback(g Service, namespace string, identity string, costTime *CostTime, err error) error

Types

type BaseJobData added in v1.0.6

type BaseJobData struct {
	Identity string `json:"identity"`
}

type CallbackReceiver added in v0.0.18

type CallbackReceiver struct {
	IdentityID string                 `json:"identityId"`
	Status     string                 `json:"status"`
	IsComplete bool                   `json:"isComplete"`
	Body       string                 `json:"body"`
	ErrMsg     string                 `json:"errMsg"`
	Args       map[string]interface{} `json:"args"`
}

func (*CallbackReceiver) InterfaceToObject added in v0.0.19

func (s *CallbackReceiver) InterfaceToObject(in interface{}) (*CallbackReceiver, error)

type CallbackSender added in v0.0.18

type CallbackSender struct {
	CallbackReceiver
	Namespace string `json:"namespace"`
	Identity  string `json:"identity"`
}

func (*CallbackSender) InterfaceToObject added in v0.0.19

func (s *CallbackSender) InterfaceToObject(in interface{}) (*CallbackSender, error)

type CostTime added in v1.0.26

type CostTime struct {
	Start time.Time
	Since time.Duration
}

func NewCostTime added in v1.0.26

func NewCostTime() *CostTime

func (*CostTime) GetMillionSecond added in v1.0.26

func (c *CostTime) GetMillionSecond() int64

type ExecHistory added in v1.0.25

type ExecHistory struct {
	Status     string    `json:"history"`
	Message    string    `json:"message"`
	CostTime   int64     `json:"costTime"`
	CompleteAt time.Time `json:"completeAt"`
}

type JobInfo

type JobInfo struct {
	Name   string
	Job    go_worker.Job
	Option *work.JobOptions
}

type Service

type Service interface {
	GetRegisterInfo() *JobInfo
	Do(job *work.Job) error
	GetTaskName() string
	GetConfig() *viper.Viper
	GetMongoClient() *mongo.Client
}

type ServiceEntity

type ServiceEntity struct {
	TaskName    string
	Config      *viper.Viper
	MongoClient *mongo.Client
}

func NewService

func NewService(TaskName string, Config *viper.Viper) *ServiceEntity

func (*ServiceEntity) Do

func (g *ServiceEntity) Do(job *work.Job) error

func (*ServiceEntity) GetConfig added in v0.0.14

func (g *ServiceEntity) GetConfig() *viper.Viper

func (*ServiceEntity) GetMongoClient added in v1.0.12

func (g *ServiceEntity) GetMongoClient() *mongo.Client

func (*ServiceEntity) GetRegisterInfo

func (g *ServiceEntity) GetRegisterInfo() *JobInfo

func (*ServiceEntity) GetTaskName added in v0.0.14

func (g *ServiceEntity) GetTaskName() string

type Status added in v0.0.18

type Status int
const (
	Pending Status = iota
	Running
	Failed
	Succeeded
)

func (Status) String added in v0.0.18

func (p Status) String() string

Jump to

Keyboard shortcuts

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