db

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PipelineCronCronExpr = "cron_expr"
	PipelineDefinitionID = "pipeline_definition_id"
	PipelineCronEnable   = "enable"
	Extra                = "extra"
	PipelineCronIsEdge   = "is_edge"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	mysqlxorm.Interface
}

func (*Client) BatchDeletePipelineCron

func (client *Client) BatchDeletePipelineCron(ids []uint64, ops ...mysqlxorm.SessionOption) error

func (*Client) BatchGetPipelineCronByDefinitionID

func (client *Client) BatchGetPipelineCronByDefinitionID(definitionIDs []string, ops ...mysqlxorm.SessionOption) (cronList []PipelineCron, err error)

func (*Client) CreatePipelineCron

func (client *Client) CreatePipelineCron(cron *PipelineCron, ops ...mysqlxorm.SessionOption) error

func (*Client) DeletePipelineCron

func (client *Client) DeletePipelineCron(id uint64, ops ...mysqlxorm.SessionOption) error

func (*Client) GetDBClient

func (client *Client) GetDBClient() (db *xorm.Engine)

func (*Client) GetPipelineCron

func (client *Client) GetPipelineCron(id uint64, ops ...mysqlxorm.SessionOption) (cron PipelineCron, bool bool, err error)

func (*Client) InsertOrUpdatePipelineCron

func (client *Client) InsertOrUpdatePipelineCron(new_ *PipelineCron, ops ...mysqlxorm.SessionOption) error

func (*Client) IsCronExist

func (client *Client) IsCronExist(cron *PipelineCron, ops ...mysqlxorm.SessionOption) (bool bool, err error)

func (*Client) ListAllPipelineCrons

func (client *Client) ListAllPipelineCrons(ops ...mysqlxorm.SessionOption) (crons []PipelineCron, err error)

func (*Client) ListPipelineCrons

func (client *Client) ListPipelineCrons(enable *bool, ops ...mysqlxorm.SessionOption) ([]PipelineCron, error)

func (*Client) PagingPipelineCron

func (client *Client) PagingPipelineCron(req *pb.CronPagingRequest, ops ...mysqlxorm.SessionOption) ([]PipelineCron, int64, error)

return: result, total, nil

func (*Client) UpdatePipelineCron

func (client *Client) UpdatePipelineCron(id uint64, cron *PipelineCron, ops ...mysqlxorm.SessionOption) error

func (*Client) UpdatePipelineCronWillUseDefault

func (client *Client) UpdatePipelineCronWillUseDefault(id uint64, cron *PipelineCron, columns []string, ops ...mysqlxorm.SessionOption) error

type PipelineCron

type PipelineCron struct {
	ID            uint64    `json:"id" xorm:"pk autoincr"`
	TimeCreated   time.Time `json:"timeCreated" xorm:"created"`           // 记录创建时间
	TimeUpdated   time.Time `json:"timeUpdated" xorm:"updated"`           // 记录更新时间
	SoftDeletedAt int64     `json:"softDeletedAt" xorm:"deleted notnull"` // 记录删除时间(时间戳形式)

	PipelineSource  apistructs.PipelineSource `json:"pipelineSource"`
	PipelineYmlName string                    `json:"pipelineYmlName"`

	CronExpr string `json:"cronExpr"`
	//PipelineSource  string            `json:"pipelineSource"`
	Enable *bool             `json:"enable"` // 1 true, 0 false
	Extra  PipelineCronExtra `json:"extra,omitempty" xorm:"json"`

	// Deprecated
	ApplicationID uint64 `json:"applicationID" xorm:"application_id"`
	// Deprecated
	Branch string `json:"branch"`
	// Deprecated
	BasePipelineID uint64 `json:"basePipelineID"` // 用于记录最开始创建出这条 cron 记录的 pipeline id
	// definition id
	PipelineDefinitionID string `json:"pipelineDefinitionID"`
	// cluster name
	ClusterName string `json:"clusterName" xorm:"cluster_name"`

	IsEdge *bool `json:"is_edge"`
}

func (*PipelineCron) Convert2DTO

func (pc *PipelineCron) Convert2DTO() *pb.Cron

func (*PipelineCron) GenCompensateCreatePipelineReqFilterLabels

func (pc *PipelineCron) GenCompensateCreatePipelineReqFilterLabels() map[string]string

func (*PipelineCron) GenCompensateCreatePipelineReqNormalLabels

func (pc *PipelineCron) GenCompensateCreatePipelineReqNormalLabels(triggerTime time.Time) map[string]string

func (PipelineCron) GetIsEdge

func (pc PipelineCron) GetIsEdge() bool

func (*PipelineCron) GetOrgID

func (pc *PipelineCron) GetOrgID() uint64

GetOrgID if org is 0, means it doesn't exist

func (*PipelineCron) GetUserID

func (pc *PipelineCron) GetUserID() string

GetUserID if user is empty, means it doesn't exist

func (PipelineCron) TableName

func (PipelineCron) TableName() string

type PipelineCronExtra

type PipelineCronExtra struct {
	PipelineYml            string            `json:"pipelineYml"`
	ClusterName            string            `json:"clusterName"`
	FilterLabels           map[string]string `json:"labels"`
	NormalLabels           map[string]string `json:"normalLabels"` // userID 存储提交流水线的用户 ID
	Envs                   map[string]string `json:"envs"`
	ConfigManageNamespaces []string          `json:"configManageNamespaces,omitempty"`
	IncomingSecrets        map[string]string `json:"incomingSecrets,omitempty"`
	CronStartFrom          *time.Time        `json:"cronStartFrom,omitempty"`
	// 新版为 v2
	Version string `json:"version"`

	// compensate
	// Compensator 老的 cron 为空,经过补偿后会自动赋值默认配置;新创建的 cron 一定会有值。
	Compensator *pb.CronCompensator `json:"compensator,omitempty"`
	//每次中断补偿执行的时间,下次中断补偿从这个时间开始查询
	LastCompensateAt *time.Time `json:"lastCompensateAt,omitempty"`
}

PipelineCronExtra cron 扩展信息, 不参与过滤

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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