models

package
v0.0.0-...-b938584 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Job

type Job struct {
	Id           primitive.ObjectID `json:"Id" bson:"_id,omitempty"`
	Name         string             `json:"Name" bson:"name" validate:"required,min=3,max=250"`
	Description  string             `json:"Description" bson:"description" validate:"required,min=3,max=500"`
	ScheduleTime time.Time          `json:"ScheduleTime" bson:"scheduleTime"`
	CreatedAt    time.Time          `json:"CreatedAt" bson:"createdAt"`
	UpdatedAt    time.Time          `json:"UpdatedAt" bson:"updatedAt"`
	Status       int32              `json:"Status" bson:"status"`
	JobType      int32              `json:"JobType" bson:"jobType"`
	JobData      string             `json:"JobData" bson:"jobData"`
	ScheduledKey int                `json:"ScheduledKey" bson:"scheduledKey"`
}

func JobFromProto_CreateJobRequest

func JobFromProto_CreateJobRequest(jbr *proto.CreateJobRequest) (*Job, error)

func JobFromProto_Job

func JobFromProto_Job(jb *proto.Job) (*Job, error)

Note: 0 values for int and empty strings will be ignored proto.

func JobFromProto_UpdateJobRequest

func JobFromProto_UpdateJobRequest(jbr *proto.UpdateJobRequest) (*Job, error)

func (*Job) ToProto

func (j *Job) ToProto() *proto.Job

type JobDB

type JobDB interface {
	Create(ctx context.Context, job *Job) (*Job, error)
	Update(ctx context.Context, job *Job) (*Job, error)
	GetByID(ctx context.Context, jobID string) (*Job, error)
	DeleteByID(ctx context.Context, jobID string) error
	GetByScheduledKey(ctx context.Context, jobScheduledKey int) (*Job, error)
	DeleteByScheduledKey(ctx context.Context, jobScheduledKey int) error
	ListALL(ctx context.Context, page int64, size int64) (*JobsList, error)
}

databas interface for Job model

type JobsList

type JobsList struct {
	TotalCount int64  `json:"totalCount"`
	TotalPages int64  `json:"totalPages"`
	Page       int64  `json:"page"`
	Size       int64  `json:"size"`
	HasMore    bool   `json:"hasMore"`
	Jobs       []*Job `json:"jobs"`
}

func (*JobsList) ToProto

func (j *JobsList) ToProto() *proto.ListJobsResponse

type JobsProducer

type JobsProducer interface {
	PublishCreate(ctx context.Context, job *Job) error
	PublishUpdate(ctx context.Context, job *Job) error
	PublishRun(ctx context.Context, job *Job) error
}

Message broker interface for Job model

Directories

Path Synopsis
job

Jump to

Keyboard shortcuts

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