models

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Artifact

type Artifact struct {
	ID         int64      `gorm:"primaryKey;autoIncrement:false" json:"id"`
	Type       string     `json:"type"`
	Format     string     `json:"format"`
	File       string     `json:"file"`
	Size       int64      `json:"size"`
	ExpiresAt  *time.Time `json:"expires_at"`
	BuildID    int64      `json:"build_id"`
	Build      Build      `gorm:"foreignKey:BuildID" json:"-"`
	PipelineID int64      `json:"pipeline_id"`
	Pipeline   Pipeline   `gorm:"foreignKey:PipelineID" json:"-"`
	CreatedAt  *time.Time `json:"created_at"`
	UpdatedAt  *time.Time `json:"updated_at"`
}

Artifact --

func (*Artifact) AfterSave

func (a *Artifact) AfterSave(tx *gorm.DB) error

AfterSave - sends channel notification

func (*Artifact) BeforeCreate

func (a *Artifact) BeforeCreate(tx *gorm.DB) error

BeforeCreate --

type Build

type Build struct {
	ID            int64            `gorm:"primaryKey;autoIncrement:false" json:"id"`
	State         string           `json:"state"`
	AllowFailure  bool             `json:"allow_failure"`
	Dependencies  string           `json:"dependencies,omitempty"`
	FinishedAt    *time.Time       `json:"finished_at,omitempty"`
	Name          string           `json:"name"`
	Job           string           `json:"job" gorm:"uniqueIndex:pipeline_stage_instance,priority:4;size:256"`
	Options       datatypes.JSON   `json:"-"` // map[string]string
	QueuedAt      *time.Time       `json:"queued_at,omitempty"`
	Stage         string           `json:"stage"`
	StageIdx      int64            `json:"stage_idx" gorm:"uniqueIndex:pipeline_stage_instance,priority:2"`
	StartedAt     *time.Time       `json:"started_at,omitempty"`
	Token         string           `json:"token"`
	When          string           `json:"when"`
	Data          []byte           `json:"data,omitempty"`
	InstanceIdx   int64            `json:"instance_idx" gorm:"default:0;uniqueIndex:pipeline_stage_instance,priority:3"`
	Duration      *int             `json:"duration"`
	Parallel      int64            `json:"parallel" gorm:"default:0;uniqueIndex:pipeline_stage_instance,priority:5;size:256"`
	Timeout       *int             `json:"timeout" gorm:"default:3600"`
	FailureReason *string          `json:"failure_reason,omitempty"`
	Retried       bool             `json:"retried" gorm:"default:0"`
	PipelineID    int64            `json:"pipeline_id" gorm:"index"`
	Pipeline      Pipeline         `` /* 148-byte string literal not displayed */
	RunnerID      *int64           `json:"runner_id"`
	Runner        *Runner          `gorm:"foreignKey:RunnerID;constraint:OnUpdate:CASCADE,OnDelete:SET NULL;" json:"-"`
	Tags          []BuildTag       `json:"tags,omitempty"`
	Variables     []*BuildVariable `json:"variables,omitempty"`
	Artifacts     []*Artifact      `json:"artifacts,omitempty"`
	CreatedAt     *time.Time       `json:"created_at"`
	UpdatedAt     *time.Time       `json:"updated_at"`
}

Build --

func (*Build) AfterSave

func (b *Build) AfterSave(tx *gorm.DB) error

AfterSave - sends channel notification

func (*Build) BeforeCreate

func (b *Build) BeforeCreate(tx *gorm.DB) error

BeforeCreate --

func (*Build) Clone

func (b *Build) Clone() (*Build, error)

Clone the build to a new build minus important information

type BuildTag

type BuildTag struct {
	Tag     string `json:"tag" gorm:"size:64;uniqueIndex:build_tag"`
	BuildID int64  `json:"-" gorm:"uniqueIndex:build_tag"`
	Build   Build  `json:"-" gorm:"constraint:OnUpdate:CASCADE,OnDelete:CASCADE" json:"-"`

	CreatedAt time.Time `json:"-"`
	UpdatedAt time.Time `json:"-"`
}

BuildTag --

func (*BuildTag) AfterSave

func (b *BuildTag) AfterSave(tx *gorm.DB) error

AfterSave - sends channel notification

type BuildVariable

type BuildVariable struct {
	*Variable
	BuildID int64 `gorm:"primaryKey" json:"build_id"`
	Build   Build `gorm:"foreignKey:BuildID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE;" json:"-"`
}

BuildVariable defines variables that are merged into specific builds and dependent builds

type GlobalVariable

type GlobalVariable struct {
	*Variable
}

GlobalVariable define variables that are merged into all jobs

func (*GlobalVariable) AfterSave

func (e *GlobalVariable) AfterSave(tx *gorm.DB) error

AfterSave - sends channel notification

type Group

type Group struct {
	ID        int64 `gorm:"primaryKey;autoIncrement:false" json:"id"`
	Name      string
	CreatedAt *time.Time `json:"created_at"`
	UpdatedAt *time.Time `json:"updated_at"`
	Users     []*User    `gorm:"many2many:user_groups"`
}

Group --

func (*Group) BeforeCreate

func (g *Group) BeforeCreate(tx *gorm.DB) error

BeforeCreate --

type Pipeline

type Pipeline struct {
	ID         int64              `gorm:"primaryKey;autoIncrement:false" json:"id"`
	Duration   int                `json:"duration,omitempty"`
	FinishedAt *time.Time         `json:"finished_at,omitempty"`
	StartedAt  *time.Time         `json:"started_at,omitempty"`
	State      string             `json:"state"`
	Data       []byte             `json:"data"`
	WorkflowID int64              `json:"workflow_id"`
	Workflow   Workflow           `json:"workflow" gorm:"foreignKey:WorkflowID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"`
	CreatedAt  *time.Time         `json:"created_at"`
	UpdatedAt  *time.Time         `json:"updated_at"`
	Builds     []Build            `json:"builds"`
	Stages     []PipelineStage    `json:"stages"`
	Variables  []PipelineVariable `json:"variables,omitempty"`
}

Pipeline --

func (*Pipeline) AfterSave

func (p *Pipeline) AfterSave(tx *gorm.DB) error

AfterSave - sends channel notification

func (*Pipeline) BeforeCreate

func (p *Pipeline) BeforeCreate(tx *gorm.DB) error

BeforeCreate --

type PipelineStage

type PipelineStage struct {
	ID         int64      `gorm:"primaryKey;autoIncrement:false" json:"id"`
	Name       string     `json:"name" gorm:"size:16,uniqueIndex:stage"`
	Index      int64      `json:"index" gorm:"uniqueIndex:stage,sort:asc"`
	State      string     `json:"state"`
	PipelineID int64      `json:"pipeline_id" gorm:"uniqueIndex:stage"`
	CreatedAt  *time.Time `json:"created_at"`
	UpdatedAt  *time.Time `json:"updated_at"`
}

PipelineStage --

func (*PipelineStage) AfterSave

func (p *PipelineStage) AfterSave(tx *gorm.DB) error

AfterSave - sends channel notification

func (*PipelineStage) BeforeCreate

func (p *PipelineStage) BeforeCreate(tx *gorm.DB) error

BeforeCreate --

type PipelineVariable

type PipelineVariable struct {
	*Variable
	PipelineID int64    `gorm:"primaryKey" json:"pipeline_id"`
	Pipeline   Pipeline `gorm:"foreignKey:PipelineID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE;" json:"-"`
}

PipelineVariable define variables that are merged into all pipeline builds

type RegisterToken

type RegisterToken struct {
	ID        int64      `json:"id" gorm:"primaryKey;autoIncrement:false"`
	Token     string     `json:"token"`
	CreatedAt *time.Time `json:"created_at"`
	UpdatedAt *time.Time `json:"updated_at"`
}

RegisterToken --

func (*RegisterToken) BeforeCreate

func (r *RegisterToken) BeforeCreate(tx *gorm.DB) error

BeforeCreate will generate a Snowflake ID

type Runner

type Runner struct {
	ID           int64       `gorm:"primaryKey;autoIncrement:false" json:"id"`
	Active       bool        `json:"active"`
	Architecture string      `json:"architecture"`
	ContactedAt  *time.Time  `json:"contacted_at"`
	Description  string      `json:"description"`
	Global       bool        `json:"global"`
	Locked       bool        `json:"locked"`
	Name         string      `json:"name"`
	Platform     string      `json:"platform"`
	Token        string      `json:"token"`
	Tags         []RunnerTag `json:"tags,omitempty"` // []string
	Version      string      `json:"version"`
	RunUntagged  bool        `json:"run_untagged"`
	CreatedAt    *time.Time  `json:"created_at"`
	UpdatedAt    *time.Time  `json:"updated_at"`
}

Runner --

func (*Runner) AfterSave

func (r *Runner) AfterSave(tx *gorm.DB) error

AfterSave - sends channel notification

func (*Runner) BeforeCreate

func (r *Runner) BeforeCreate(tx *gorm.DB) error

BeforeCreate --

type RunnerTag

type RunnerTag struct {
	Tag      string `json:"tag" gorm:"primaryKey;size:64"`
	RunnerID int64  `json:"runner_id" gorm:"primaryKey"`
	Runner   Runner `json:"runner" gorm:"constraint:OnUpdate:CASCADE,OnDelete:CASCADE" json:"-"`

	CreatedAt time.Time
	UpdatedAt time.Time
}

RunnerTag --

func (*RunnerTag) AfterSave

func (e *RunnerTag) AfterSave(tx *gorm.DB) error

AfterSave - sends channel notification

type Schedule

type Schedule struct {
	ID         int64      `gorm:"primaryKey;autoIncrement:false" json:"id"`
	Name       string     `json:"name"`
	Cron       string     `json:"cron"`
	Last       *time.Time `json:"last"`
	Next       *time.Time `json:"next"`
	WorkflowID int64      `json:"workflow_id"`
	Workflow   Workflow   `gorm:"foreignKey:WorkflowID" json:"workflow"`
	CreatedAt  *time.Time `json:"created_at"`
	UpdatedAt  *time.Time `json:"updated_at"`
}

Schedule --

func (*Schedule) BeforeCreate

func (b *Schedule) BeforeCreate(tx *gorm.DB) error

BeforeCreate will generate a Snowflake ID

func (*Schedule) BeforeUpdate

func (b *Schedule) BeforeUpdate(tx *gorm.DB) error

BeforeUpdate --

type ScheduleVariable

type ScheduleVariable struct {
	*Variable
	BuildID int64 `gorm:"primaryKey" json:"build_id"`
	Build   Build `gorm:"foreignKey:BuildID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE;" json:"-"`
}

ScheduleVariable defines variables that are merged into pipelines when run by a schedule

type Setting

type Setting struct {
	*gorm.Model

	Name  string `json:"name" gorm:"primaryKey;autoIncrement:false"`
	Value string `json:"value"`
}

Setting --

type Trace

type Trace struct {
	ID        int64       `gorm:"primaryKey;autoIncrement:false" json:"id"`
	BuildID   int64       `gorm:"unique" json:"build_id"`
	Build     Build       `gorm:"constraint:OnUpdate:CASCADE,OnDelete:CASCADE;" json:"build"`
	CreatedAt *time.Time  `json:"created_at"`
	UpdatedAt *time.Time  `json:"updated_at"`
	Parts     []TracePart `json:"parts,omitempty"`
}

Trace --

func (*Trace) BeforeCreate

func (b *Trace) BeforeCreate(tx *gorm.DB) error

BeforeCreate will generate a Snowflake ID

type TracePart

type TracePart struct {
	ID        int64      `gorm:"primaryKey;autoIncrement:false" json:"id"`
	Start     int        `json:"start"`
	End       int        `json:"end"`
	Size      int        `json:"size"`
	Data      []byte     `json:"data"`
	TraceID   int64      `json:"trace_id"`
	Trace     Trace      `gorm:"constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"  json:"trace"`
	CreatedAt *time.Time `json:"created_at"`
	UpdatedAt *time.Time `json:"updated_at"`
}

TracePart --

func (*TracePart) BeforeCreate

func (b *TracePart) BeforeCreate(tx *gorm.DB) error

BeforeCreate will generate a Snowflake ID

type User

type User struct {
	ID        int64 `gorm:"primaryKey;autoIncrement:false" json:"id"`
	Name      string
	Username  string
	Password  string
	Groups    []*Group   `gorm:"many2many:user_groups"`
	CreatedAt *time.Time `json:"created_at"`
	UpdatedAt *time.Time `json:"updated_at"`
}

User --

func (*User) BeforeCreate

func (u *User) BeforeCreate(tx *gorm.DB) error

BeforeCreate --

type Variable

type Variable struct {
	Name     string `gorm:"primaryKey;autoIncrement:false" json:"name"`
	Value    string `json:"value"`
	Masked   bool   `json:"masked" gorm:"default:0"`
	File     bool   `json:"file" gorm:"default:0"`
	Internal bool   `json:"internal" gorm:"default:0"`
	Public   bool   `json:"public" gorm:"default:1"`

	// TODO: switch to pointers?
	CreatedAt time.Time `json:"created_at,omitempty"`
	UpdatedAt time.Time `json:"updated_at,omitempty"`
}

Variable --

type VueWebsocketMessage

type VueWebsocketMessage struct {
	Namespace string      `json:"namespace,omitempty"`
	Mutation  string      `json:"mutation,omitempty"`
	Action    string      `json:"action,omitempty"`
	Data      interface{} `json:"data"`
}

VueWebsocketMessage --

type Workflow

type Workflow struct {
	ID        int64      `json:"id" gorm:"primaryKey;autoIncrement:false"`
	Name      string     `json:"name" gorm:"uniqueIndex;size:256"`
	Data      string     `json:"data,omitempty"`
	CreatedAt *time.Time `json:"created_at"`
	UpdatedAt *time.Time `json:"updated_at"`
}

Workflow --

func (*Workflow) AfterSave

func (w *Workflow) AfterSave(tx *gorm.DB) error

AfterSave - sends channel notification

func (*Workflow) BeforeCreate

func (w *Workflow) BeforeCreate(tx *gorm.DB) error

BeforeCreate Hook

type WorkflowVariable

type WorkflowVariable struct {
	*Variable
	WorkflowID int64    `gorm:"primaryKey" json:"workflow_id"`
	Workflow   Workflow `gorm:"foreignKey:WorkflowID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE;" json:"-"`
}

WorkflowVariable define variables that are merged into all pipelines for a workflow

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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