model

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Settings = &settings.Settings
)

Functions

func All

func All() []interface{}

All builds all models. Models are enumerated such that each are listed after all the other models on which they may depend.

Types

type Application

type Application struct {
	Model
	BucketOwner
	Name              string `gorm:"index;unique;not null"`
	Description       string
	Review            *Review `gorm:"constraint:OnDelete:CASCADE"`
	Repository        JSON    `gorm:"type:json"`
	Binary            string
	Facts             []Fact `gorm:"constraint:OnDelete:CASCADE"`
	Comments          string
	Tasks             []Task     `gorm:"constraint:OnDelete:CASCADE"`
	Tags              []Tag      `gorm:"many2many:ApplicationTags"`
	Identities        []Identity `gorm:"many2many:ApplicationIdentity;constraint:OnDelete:CASCADE"`
	BusinessServiceID *uint      `gorm:"index"`
	BusinessService   *BusinessService
}

type ApplicationTag added in v0.1.0

type ApplicationTag struct {
	ApplicationID uint        `gorm:"primaryKey"`
	TagID         uint        `gorm:"primaryKey"`
	Source        string      `gorm:"primaryKey;not null"`
	Application   Application `gorm:"constraint:OnDelete:CASCADE"`
	Tag           Tag         `gorm:"constraint:OnDelete:CASCADE"`
}

ApplicationTag represents a row in the join table for the many-to-many relationship between Applications and Tags.

func (ApplicationTag) TableName added in v0.1.0

func (ApplicationTag) TableName() string

TableName must return "ApplicationTags" to ensure compatibility with the autogenerated join table name.

type Bucket added in v0.1.0

type Bucket struct {
	Model
	Path       string `gorm:"<-:create;uniqueIndex"`
	Expiration *time.Time
}

func (*Bucket) BeforeCreate added in v0.1.0

func (m *Bucket) BeforeCreate(db *gorm.DB) (err error)

type BucketOwner

type BucketOwner struct {
	BucketID *uint `gorm:"index" ref:"bucket"`
	Bucket   *Bucket
}

func (*BucketOwner) BeforeCreate

func (m *BucketOwner) BeforeCreate(db *gorm.DB) (err error)

func (*BucketOwner) HasBucket added in v0.1.0

func (m *BucketOwner) HasBucket() (b bool)

func (*BucketOwner) SetBucket added in v0.1.0

func (m *BucketOwner) SetBucket(id *uint)

type BusinessService

type BusinessService = v2.BusinessService

type Dependency

type Dependency = v2.Dependency

type DependencyCyclicError

type DependencyCyclicError = v2.DependencyCyclicError

Errors

type Fact added in v0.1.0

type Fact struct {
	ApplicationID uint   `gorm:"<-:create;primaryKey"`
	Key           string `gorm:"<-:create;primaryKey"`
	Value         JSON   `gorm:"type:json;not null"`
	Application   *Application
}

type File added in v0.1.0

type File struct {
	Model
	Name       string
	Path       string `gorm:"<-:create;uniqueIndex"`
	Expiration *time.Time
}

func (*File) BeforeCreate added in v0.1.0

func (m *File) BeforeCreate(db *gorm.DB) (err error)

type Identity

type Identity = v2.Identity

type Import

type Import struct {
	Model
	Filename            string
	ApplicationName     string
	BusinessService     string
	Comments            string
	Dependency          string
	DependencyDirection string
	Description         string
	ErrorMessage        string
	IsValid             bool
	RecordType1         string
	ImportSummary       ImportSummary
	ImportSummaryID     uint `gorm:"index"`
	Processed           bool
	ImportTags          []ImportTag `gorm:"constraint:OnDelete:CASCADE"`
	BinaryGroup         string
	BinaryArtifact      string
	BinaryVersion       string
	BinaryPackaging     string
	RepositoryKind      string
	RepositoryURL       string
	RepositoryBranch    string
	RepositoryPath      string
}

func (*Import) AsMap

func (r *Import) AsMap() (m map[string]interface{})

type ImportSummary

type ImportSummary struct {
	Model
	Content        []byte
	Filename       string
	ImportStatus   string
	Imports        []Import `gorm:"constraint:OnDelete:CASCADE"`
	CreateEntities bool
}

type ImportTag

type ImportTag struct {
	Model
	Name     string
	Category string
	ImportID uint `gorm:"index"`
	Import   *Import
}

type IssueType

type IssueType struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

type JSON

type JSON = []byte

JSON field (data) type.

type JobFunction

type JobFunction = v2.JobFunction

type Map

type Map = map[string]interface{}

Map alias.

type Metadata

type Metadata struct {
	Projects []Project `json:"projects"`
}

type Model

type Model = v2.Model

Unchanged models imported from previous migration.

type Project

type Project struct {
	ID         string      `json:"id"`
	Key        string      `json:"key"`
	Name       string      `json:"name"`
	IssueTypes []IssueType `json:"issueTypes"`
}

type Proxy

type Proxy = v2.Proxy

type Review

type Review = v2.Review

type RuleBundle added in v0.1.0

type RuleBundle struct {
	Model
	Kind        string
	Name        string `gorm:"uniqueIndex;not null"`
	Description string
	Custom      bool
	Repository  JSON `gorm:"type:json"`
	ImageID     uint `gorm:"index" ref:"file"`
	Image       *File
	IdentityID  *uint `gorm:"index"`
	Identity    *Identity
	RuleSets    []RuleSet `gorm:"constraint:OnDelete:CASCADE"`
}

RuleBundle - Analysis rules.

type RuleSet added in v0.1.0

type RuleSet struct {
	Model
	Name         string `gorm:"uniqueIndex:RuleSetA;not null"`
	Description  string
	Metadata     JSON `gorm:"type:json"`
	RuleBundleID uint `gorm:"uniqueIndex:RuleSetA;not null"`
	RuleBundle   *RuleBundle
	FileID       *uint `gorm:"index" ref:"file"`
	File         *File
}

RuleSet - Analysis ruleset.

type Setting added in v0.1.0

type Setting = v2.Setting

type Stakeholder

type Stakeholder = v2.Stakeholder

type StakeholderGroup

type StakeholderGroup = v2.StakeholderGroup

type TTL

type TTL struct {
	Created   int `json:"created,omitempty"`
	Pending   int `json:"pending,omitempty"`
	Postponed int `json:"postponed,omitempty"`
	Running   int `json:"running,omitempty"`
	Succeeded int `json:"succeeded,omitempty"`
	Failed    int `json:"failed,omitempty"`
}

TTL time-to-live.

type Tag

type Tag struct {
	Model
	Name       string `gorm:"uniqueIndex:tagA;not null"`
	Username   string
	CategoryID uint `gorm:"uniqueIndex:tagA;index;not null"`
	Category   TagCategory
}

type TagCategory added in v0.1.0

type TagCategory struct {
	Model
	Name     string `gorm:"index;unique;not null"`
	Username string
	Rank     uint
	Color    string
	Tags     []Tag `gorm:"foreignKey:CategoryID;constraint:OnDelete:CASCADE"`
}

type TagType

type TagType = v2.TagType

type Task

type Task struct {
	Model
	BucketOwner
	Name          string `gorm:"index"`
	Addon         string `gorm:"index"`
	Locator       string `gorm:"index"`
	Priority      int
	Image         string
	Variant       string
	Policy        string
	TTL           JSON
	Data          JSON
	Started       *time.Time
	Terminated    *time.Time
	State         string `gorm:"index"`
	Error         string
	Pod           string `gorm:"index"`
	Retries       int
	Canceled      bool
	Report        *TaskReport `gorm:"constraint:OnDelete:CASCADE"`
	ApplicationID *uint
	Application   *Application
	TaskGroupID   *uint `gorm:"<-:create"`
	TaskGroup     *TaskGroup
}

func (*Task) BeforeCreate

func (m *Task) BeforeCreate(db *gorm.DB) (err error)

func (*Task) Reset

func (m *Task) Reset()

type TaskGroup

type TaskGroup struct {
	Model
	BucketOwner
	Name  string
	Addon string
	Data  JSON
	Tasks []Task `gorm:"constraint:OnDelete:CASCADE"`
	List  JSON
	State string
}

func (*TaskGroup) Propagate

func (m *TaskGroup) Propagate() (err error)

Propagate group data into the task.

type TaskReport

type TaskReport = v2.TaskReport

type Ticket

type Ticket struct {
	Model
	// Kind of ticket in the external tracker.
	Kind string `gorm:"not null"`
	// Parent resource that this ticket should belong to in the tracker. (e.g. Jira project)
	Parent string `gorm:"not null"`
	// Custom fields to send to the tracker when creating the ticket
	Fields JSON `gorm:"type:json"`
	// Whether the last attempt to do something with the ticket reported an error
	Error bool
	// Error message, if any
	Message string
	// Whether the ticket was created in the external tracker
	Created bool
	// Reference id in external tracker
	Reference string
	// URL to ticket in external tracker
	Link string
	// Status of ticket in external tracker
	Status        string
	LastUpdated   time.Time
	Application   *Application
	ApplicationID uint `gorm:"uniqueIndex:ticketA;not null"`
	Tracker       *Tracker
	TrackerID     uint `gorm:"uniqueIndex:ticketA;not null"`
}

type Tracker

type Tracker struct {
	Model
	Name        string `gorm:"index;unique;not null"`
	URL         string
	Kind        string
	Identity    *Identity
	IdentityID  uint
	Metadata    JSON `gorm:"type:json"`
	Connected   bool
	LastUpdated time.Time
	Message     string
	Tickets     []Ticket `gorm:"constraint:OnDelete:CASCADE"`
}

Jump to

Keyboard shortcuts

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