model

package
v1.0.18 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Callback added in v1.0.9

func Callback(g Service, identity string, 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 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