model

package
v0.5.0-beta.3 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2024 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() []any

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

func Seed added in v0.1.0

func Seed(db *gorm.DB)

Seed the database with models.

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
	Comments          string
	Facts             JSON       `gorm:"type:json"`
	Tasks             []Task     `gorm:"constraint:OnDelete:CASCADE"`
	Tags              []Tag      `gorm:"many2many:ApplicationTags;constraint:OnDelete:CASCADE"`
	Identities        []Identity `gorm:"many2many:ApplicationIdentity;constraint:OnDelete:CASCADE"`
	BusinessServiceID *uint      `gorm:"index"`
	BusinessService   *BusinessService
}

type BucketOwner

type BucketOwner struct {
	Bucket string `gorm:"index"`
}

func (*BucketOwner) BeforeCreate added in v0.1.0

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

type BusinessService

type BusinessService struct {
	Model
	Name          string `gorm:"index;unique;not null"`
	Description   string
	Applications  []Application `gorm:"constraint:OnDelete:SET NULL"`
	StakeholderID *uint         `gorm:"index"`
	Stakeholder   *Stakeholder
}

type Dependency

type Dependency struct {
	Model
	ToID   uint         `gorm:"index"`
	To     *Application `gorm:"foreignKey:ToID;constraint:OnDelete:CASCADE"`
	FromID uint         `gorm:"index"`
	From   *Application `gorm:"foreignKey:FromID;constraint:OnDelete:CASCADE"`
}

func (*Dependency) BeforeCreate added in v0.1.0

func (r *Dependency) BeforeCreate(db *gorm.DB) (err error)

Validation Hook to avoid cyclic dependencies.

func (*Dependency) Create added in v0.1.0

func (r *Dependency) Create(db *gorm.DB) (err error)

Create a dependency synchronized using a mutex.

type DependencyCyclicError

type DependencyCyclicError struct{}

Custom error type to allow API recognize Cyclic Dependency error and assign proper status code.

func (DependencyCyclicError) Error

func (err DependencyCyclicError) Error() string

type Identity

type Identity struct {
	Model
	Kind        string `gorm:"not null"`
	Name        string `gorm:"not null"`
	Description string
	User        string
	Password    string
	Key         string
	Settings    string
	Proxies     []Proxy `gorm:"constraint:OnDelete:SET NULL"`
}

Identity represents and identity with a set of credentials.

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 added in v0.1.0

func (r *Import) AsMap() (m map[string]any)

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
	TagType  string
	ImportID uint `gorm:"index"`
	Import   *Import
}

type JSON

type JSON = []byte

JSON field (data) type.

type JobFunction

type JobFunction struct {
	Model
	Username     string
	Name         string        `gorm:"index;unique;not null"`
	Stakeholders []Stakeholder `gorm:"constraint:OnDelete:SET NULL"`
}

type Map

type Map = map[string]any

Map alias.

type Model

type Model struct {
	ID         uint      `gorm:"<-:create;primaryKey"`
	CreateTime time.Time `gorm:"<-:create;autoCreateTime"`
	CreateUser string    `gorm:"<-:create"`
	UpdateUser string
}

Model Base model.

type Proxy

type Proxy struct {
	Model
	Enabled    bool
	Kind       string `gorm:"uniqueIndex"`
	Host       string `gorm:"not null"`
	Port       int
	Excluded   JSON  `gorm:"type:json"`
	IdentityID *uint `gorm:"index"`
	Identity   *Identity
}

Proxy configuration. kind = (http|https)

type Review

type Review struct {
	Model
	BusinessCriticality uint   `gorm:"not null"`
	EffortEstimate      string `gorm:"not null"`
	ProposedAction      string `gorm:"not null"`
	WorkPriority        uint   `gorm:"not null"`
	Comments            string
	ApplicationID       uint `gorm:"uniqueIndex"`
	Application         *Application
}

type Setting added in v0.1.0

type Setting struct {
	Model
	Key   string `gorm:"<-:create;uniqueIndex"`
	Value JSON   `gorm:"type:json"`
}

type Stakeholder

type Stakeholder struct {
	Model
	Name             string             `gorm:"not null;"`
	Email            string             `gorm:"index;unique;not null"`
	Groups           []StakeholderGroup `gorm:"many2many:StakeholderGroupStakeholder;constraint:OnDelete:CASCADE"`
	BusinessServices []BusinessService  `gorm:"constraint:OnDelete:SET NULL"`
	JobFunctionID    *uint              `gorm:"index"`
	JobFunction      *JobFunction
}

type StakeholderGroup

type StakeholderGroup struct {
	Model
	Name         string `gorm:"index;unique;not null"`
	Username     string
	Description  string
	Stakeholders []Stakeholder `gorm:"many2many:StakeholderGroupStakeholder;constraint:OnDelete:CASCADE"`
}

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
	TagTypeID uint `gorm:"uniqueIndex:tagA;index;not null"`
	TagType   TagType
}

type TagType

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

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 `gorm:"type:json"`
	Data          JSON `gorm:"type: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 added in v0.1.0

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

func (*Task) Reset added in v0.1.0

func (m *Task) Reset()

type TaskGroup

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

func (*TaskGroup) Propagate added in v0.1.0

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

Propagate group data into the task.

type TaskReport

type TaskReport struct {
	Model
	Status    string
	Error     string
	Total     int
	Completed int
	Activity  JSON `gorm:"type:json"`
	Result    JSON `gorm:"type:json"`
	TaskID    uint `gorm:"<-:create;uniqueIndex"`
	Task      *Task
}

Jump to

Keyboard shortcuts

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