models

package
v0.0.0-...-c3e479f Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const TableNameDomain = "domains"
View Source
const TableNameEnvironment = "environments"
View Source
const TableNameEnvironmentsRepositories = "repositories_environments"
View Source
const TableNamePackageGroup = "package_groups"
View Source
const TableNamePackageGroupsRepositories = "repositories_package_groups"
View Source
const TableNameRpm = "rpms"
View Source
const TableNameRpmsRepositories = "repositories_rpms"
View Source
const TableNameSnapshot = "snapshots"
View Source
const TableNameTemplatesRepositoryConfigurations = "templates_repository_configurations"

Variables

This section is empty.

Functions

func CandlepinContentGpgKeyUrl

func CandlepinContentGpgKeyUrl(orgID string, repoConfigUUID string) *string

func CleanupURL

func CleanupURL(url string) string

CleanupURL removes leading and trailing whitespace and adds trailing slash

func RepoConfigGpgKeyURL

func RepoConfigGpgKeyURL(orgID string, repoConfigUUID string) *string

Types

type Base

type Base struct {
	UUID      string `gorm:"primary_key" json:"uuid"`
	CreatedAt time.Time
	UpdatedAt time.Time
}

func (*Base) AfterFind

func (base *Base) AfterFind(db *gorm.DB) error

func (*Base) AfterSave

func (base *Base) AfterSave(db *gorm.DB) error

func (*Base) BeforeCreate

func (base *Base) BeforeCreate(db *gorm.DB) (err error)

func (*Base) DeepCopy

func (in *Base) DeepCopy() *Base

func (*Base) DeepCopyInto

func (in *Base) DeepCopyInto(out *Base)

type ContentCountsType

type ContentCountsType map[string]int64

func (*ContentCountsType) Scan

func (cc *ContentCountsType) Scan(src interface{}) error

func (*ContentCountsType) Value

func (cc *ContentCountsType) Value() (driver.Value, error)

type Domain

type Domain struct {
	DomainName string `json:"domain_name" gorm:"not null"`
	OrgId      string `json:"org_id" gorm:"not null"`
}

Domain model keeps track of the mapping between org id and the generated domain name

type Environment

type Environment struct {
	Base
	ID           string       `json:"id" gorm:"not null"`
	Name         string       `json:"name" gorm:"not null"`
	Description  string       `json:"description"`
	Repositories []Repository `gorm:"many2many:repositories_environments"`
}

RepositoryEnvironment model for the gorm object of the database which represents an environment which belongs to one repository.

func (*Environment) BeforeCreate

func (r *Environment) BeforeCreate(tx *gorm.DB) (err error)

BeforeCreate hook performs validations and sets UUID of RepositoryEnvironment

func (*Environment) DeepCopy

func (in *Environment) DeepCopy() *Environment

DeepCopy clone a RepositoryEnvironment struct

func (*Environment) DeepCopyInto

func (in *Environment) DeepCopyInto(out *Environment)

type Error

type Error struct {
	Message    string
	Validation bool
}

func (Error) Error

func (e Error) Error() string

type PackageGroup

type PackageGroup struct {
	Base
	ID           string         `json:"id" gorm:"not null"`
	Name         string         `json:"name" gorm:"not null"`
	Description  string         `json:"description"`
	PackageList  pq.StringArray `json:"packagelist" gorm:"type:text"`
	HashValue    string         `json:"hashvalue"`
	Repositories []Repository   `gorm:"many2many:repositories_package_groups"`
}

RepositoryPackageGroup model for the gorm object of the database which represent a package group which belong to one repository.

func (*PackageGroup) BeforeCreate

func (r *PackageGroup) BeforeCreate(tx *gorm.DB) (err error)

BeforeCreate hook performs validations and sets UUID of RepositoryPackageGroup

func (*PackageGroup) DeepCopy

func (in *PackageGroup) DeepCopy() *PackageGroup

DeepCopy clone a RepositoryPackageGroup struct

func (*PackageGroup) DeepCopyInto

func (in *PackageGroup) DeepCopyInto(out *PackageGroup)

type Repository

type Repository struct {
	Base
	URL                          string `gorm:"unique;default:null"`
	RepomdChecksum               string `gorm:"default:null"`
	Public                       bool
	LastIntrospectionTime        *time.Time                `gorm:"default:null"`
	LastIntrospectionSuccessTime *time.Time                `gorm:"default:null"`
	LastIntrospectionUpdateTime  *time.Time                `gorm:"default:null"`
	LastIntrospectionError       *string                   `gorm:"default:null"`
	LastIntrospectionStatus      string                    `gorm:"default:Pending"`
	PackageCount                 int                       `gorm:"default:0;not null"`
	FailedIntrospectionsCount    int                       `gorm:"default:0;not null"`
	RepositoryConfigurations     []RepositoryConfiguration `gorm:"foreignKey:RepositoryUUID"`
	Rpms                         []Rpm                     `gorm:"many2many:repositories_rpms"`
	PackageGroups                []PackageGroup            `gorm:"many2many:repositories_package_groups"`
	Origin                       string                    `gorm:"default:external;not null"`
	ContentType                  string                    `gorm:"default:rpm;not null"`
}

https://stackoverflow.com/questions/43587610/preventing-null-or-empty-string-values-in-the-db

func (*Repository) AfterFind

func (r *Repository) AfterFind(tx *gorm.DB) error

func (*Repository) AfterSave

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

func (*Repository) BeforeCreate

func (r *Repository) BeforeCreate(tx *gorm.DB) (err error)

func (*Repository) DeepCopy

func (in *Repository) DeepCopy() *Repository

func (*Repository) DeepCopyInto

func (in *Repository) DeepCopyInto(out *Repository)

func (*Repository) MapForUpdate

func (r *Repository) MapForUpdate() map[string]interface{}

type RepositoryConfiguration

type RepositoryConfiguration struct {
	Base
	Name                 string         `json:"name" gorm:"default:null"`
	Versions             pq.StringArray `json:"version" gorm:"type:text[],default:null"`
	Arch                 string         `json:"arch" gorm:"default:''"`
	GpgKey               string         `json:"gpg_key" gorm:"default:''"`
	Label                string         `json:"label" gorm:"default:''"`
	MetadataVerification bool           `json:"metadata_verification" gorm:"default:false"`
	ModuleHotfixes       bool           `json:"module_hotfixes" gorm:"default:false"`
	AccountID            string         `json:"account_id" gorm:"default:null"`
	OrgID                string         `json:"org_id" gorm:"default:null"`
	RepositoryUUID       string         `json:"repository_uuid" gorm:"not null"`
	Repository           Repository     `json:"repository,omitempty"`
	Snapshot             bool           `json:"snapshot"`
	DeletedAt            gorm.DeletedAt `json:"deleted_at"`
	LastSnapshotUUID     string         `json:"last_snapshot_uuid" gorm:"default:null"`
	LastSnapshot         *Snapshot      `json:"last_snapshot,omitempty" gorm:"foreignKey:last_snapshot_uuid"`
	LastSnapshotTaskUUID string         `json:"last_snapshot_task_uuid" gorm:"default:null"`
	LastSnapshotTask     *TaskInfo      `json:"last_snapshot_task" gorm:"foreignKey:last_snapshot_task_uuid"`
}

func (*RepositoryConfiguration) AfterFind

func (rc *RepositoryConfiguration) AfterFind(tx *gorm.DB) error

func (*RepositoryConfiguration) AfterSave

func (rc *RepositoryConfiguration) AfterSave(tx *gorm.DB) error

func (*RepositoryConfiguration) BeforeCreate

func (rc *RepositoryConfiguration) BeforeCreate(tx *gorm.DB) error

BeforeCreate perform validations and sets UUID of Repository Configurations

func (*RepositoryConfiguration) BeforeUpdate

func (rc *RepositoryConfiguration) BeforeUpdate(tx *gorm.DB) error

BeforeUpdate perform validations of Repository Configurations

func (*RepositoryConfiguration) DedupeVersions

func (rc *RepositoryConfiguration) DedupeVersions(tx *gorm.DB) error

func (*RepositoryConfiguration) DeepCopy

func (*RepositoryConfiguration) DeepCopyInto

func (rc *RepositoryConfiguration) DeepCopyInto(out *RepositoryConfiguration)

func (*RepositoryConfiguration) IsRedHat

func (rc *RepositoryConfiguration) IsRedHat() bool

func (*RepositoryConfiguration) MapForUpdate

func (rc *RepositoryConfiguration) MapForUpdate() map[string]interface{}

When updating a model with gorm, we want to explicitly update any field that is set to empty string. We always fetch the object and then update it before saving so every update is the full model of user changeable fields. So OrgId and account Id are excluded

func (*RepositoryConfiguration) ReplaceEmptyValues

func (rc *RepositoryConfiguration) ReplaceEmptyValues(tx *gorm.DB) error

func (*RepositoryConfiguration) SetLabel

func (rc *RepositoryConfiguration) SetLabel(tx *gorm.DB) error

type RepositoryEnvironment

type RepositoryEnvironment struct {
	RepositoryUUID  string `json:"repository_uuid" gorm:"not null"`
	EnvironmentUUID string `json:"environment_uuid" gorm:"not null"`
}

func (*RepositoryEnvironment) BeforeCreate

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

func (*RepositoryEnvironment) TableName

func (r *RepositoryEnvironment) TableName() string

type RepositoryPackageGroup

type RepositoryPackageGroup struct {
	RepositoryUUID   string `json:"repository_uuid" gorm:"not null"`
	PackageGroupUUID string `json:"package_group_uuid" gorm:"not null"`
}

func (*RepositoryPackageGroup) BeforeCreate

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

func (*RepositoryPackageGroup) TableName

func (r *RepositoryPackageGroup) TableName() string

type RepositoryRpm

type RepositoryRpm struct {
	RepositoryUUID string `json:"repository_uuid" gorm:"not null"`
	RpmUUID        string `json:"rpm_uuid" gorm:"not null"`
}

func (*RepositoryRpm) BeforeCreate

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

func (*RepositoryRpm) TableName

func (r *RepositoryRpm) TableName() string

type Rpm

type Rpm struct {
	Base
	Name    string `json:"name" gorm:"not null"`
	Arch    string `json:"arch" gorm:"not null"`
	Version string `json:"version" gorm:"not null"`
	Release string `json:"release" gorm:"null"`
	// Epoch is a way to define weighted dependencies based
	// on version numbers. It's default value is 0 and this
	// is assumed if an Epoch directive is not listed in the RPM SPEC file.
	// https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/packaging_and_distributing_software/advanced-topics#packaging-epoch_epoch-scriplets-and-triggers
	Epoch        int32        `json:"epoch" gorm:"default:0;not null"`
	Summary      string       `json:"summary" gorm:"not null"`
	Checksum     string       `json:"checksum" gorm:"not null"`
	Repositories []Repository `gorm:"many2many:repositories_rpms"`
}

RepositoryRpm model for the gorm object of the database which represent a RPM package which belong to one repository.

func (*Rpm) BeforeCreate

func (r *Rpm) BeforeCreate(tx *gorm.DB) (err error)

BeforeCreate hook performs validations and sets UUID of RepositoryRpm

func (*Rpm) DeepCopy

func (in *Rpm) DeepCopy() *Rpm

DeepCopy clone a RepositoryRpm struct

func (*Rpm) DeepCopyInto

func (in *Rpm) DeepCopyInto(out *Rpm)

type Snapshot

type Snapshot struct {
	Base
	DeletedAt                   gorm.DeletedAt `json:"deleted_at"`
	VersionHref                 string         `json:"version_href" gorm:"not null"`
	PublicationHref             string         `json:"publication_href" gorm:"not null"`
	DistributionPath            string         `json:"distribution_path" gorm:"not null"`
	RepositoryPath              string         `json:"repository_path" gorm:"not null"` // Path to access the repository, includes domain
	DistributionHref            string         `json:"distribution_href" gorm:"not null"`
	RepositoryConfigurationUUID string         `json:"repository_configuration_uuid" gorm:"not null"`
	ContentGuardAdded           bool           `json:"content_guard_added" gorm:"not null"`
	RepositoryConfiguration     RepositoryConfiguration
	ContentCounts               ContentCountsType `json:"content_counts" gorm:"not null,default:{}"`
	AddedCounts                 ContentCountsType `json:"added_counts" gorm:"not null,default:{}"`
	RemovedCounts               ContentCountsType `json:"removed_counts" gorm:"not null,default:{}"`
}

type TaskInfo

type TaskInfo struct {
	Id              uuid.UUID       `gorm:"primary_key;column:id"`
	Typename        string          `gorm:"column:type"` // "introspect" or "snapshot"
	Payload         json.RawMessage `gorm:"type:jsonb"`
	OrgId           string
	AccountId       string
	ObjectUUID      uuid.UUID
	ObjectType      *string
	Dependencies    pq.StringArray `gorm:"->;column:t_dependencies;type:text[]"`
	Dependents      pq.StringArray `gorm:"->;column:t_dependents;type:text[]"`
	Token           uuid.UUID
	Queued          *time.Time `gorm:"column:queued_at"`
	Started         *time.Time `gorm:"column:started_at"`
	Finished        *time.Time `gorm:"column:finished_at"`
	Error           *string
	Status          string
	RequestID       string
	Retries         int
	NextRetryTime   *time.Time
	Priority        int
	CancelAttempted bool
}

Shared by DAO and queue packages GORM only used in DAO to read from table

func (*TaskInfo) AfterFind

func (t *TaskInfo) AfterFind(tx *gorm.DB) error

func (*TaskInfo) AfterSave

func (t *TaskInfo) AfterSave(tx *gorm.DB) error

func (*TaskInfo) TableName

func (*TaskInfo) TableName() string

type TaskInfoRepositoryConfiguration

type TaskInfoRepositoryConfiguration struct {
	*TaskInfo
	RepositoryConfigUUID string `gorm:"column:rc_uuid"`
	RepositoryConfigName string `gorm:"column:rc_name"`
	TemplateUUID         string `gorm:"column:template_uuid"`
	TemplateName         string `gorm:"column:template_name"`
}

type Template

type Template struct {
	Base
	Name                             string         `gorm:"not null;default:null"`
	OrgID                            string         `gorm:"default:null"`
	Description                      string         `gorm:"default:null"`
	Date                             time.Time      `gorm:"default:null"`
	Version                          string         `gorm:"default:null"`
	Arch                             string         `gorm:"default:null"`
	DeletedAt                        gorm.DeletedAt `json:"deleted_at"`
	CreatedBy                        string
	LastUpdatedBy                    string
	UseLatest                        bool
	RHSMEnvironmentCreated           bool                              `json:"rhsm_environment_created" gorm:"column:rhsm_environment_created"`
	LastUpdateSnapshotError          *string                           `gorm:"default:null"`
	LastUpdateTaskUUID               string                            `json:"last_update_task_uuid" gorm:"default:null"`
	LastUpdateTask                   *TaskInfo                         `json:"last_update_task" gorm:"foreignKey:last_update_task_uuid"`
	TemplateRepositoryConfigurations []TemplateRepositoryConfiguration `gorm:"foreignKey:TemplateUUID"`
}

func (*Template) AfterFind

func (t *Template) AfterFind(tx *gorm.DB) error

func (*Template) AfterSave

func (t *Template) AfterSave(tx *gorm.DB) error

func (*Template) BeforeCreate

func (t *Template) BeforeCreate(tx *gorm.DB) error

BeforeCreate perform validations and sets UUID of Template

func (*Template) BeforeUpdate

func (t *Template) BeforeUpdate(tx *gorm.DB) error

BeforeUpdate perform validations and sets UUID of Template

func (*Template) MapForUpdate

func (t *Template) MapForUpdate() map[string]interface{}

type TemplateRepositoryConfiguration

type TemplateRepositoryConfiguration struct {
	RepositoryConfigurationUUID string         `json:"repository_configuration_uuid" gorm:"not null"`
	TemplateUUID                string         `json:"template_uuid" gorm:"not null"`
	SnapshotUUID                string         `json:"snapshot_uuid" gorm:"not null"`
	Snapshot                    Snapshot       `json:"snapshot" gorm:"foreignkey:SnapshotUUID"`
	DistributionHref            string         `json:"distribution_href"`
	DeletedAt                   gorm.DeletedAt `json:"deleted_at"`
}

func (*TemplateRepositoryConfiguration) AfterFind

func (t *TemplateRepositoryConfiguration) AfterFind(tx *gorm.DB) error

func (*TemplateRepositoryConfiguration) AfterSave

func (t *TemplateRepositoryConfiguration) AfterSave(tx *gorm.DB) error

func (*TemplateRepositoryConfiguration) BeforeCreate

func (t *TemplateRepositoryConfiguration) BeforeCreate(db *gorm.DB) (err error)

func (*TemplateRepositoryConfiguration) TableName

func (t *TemplateRepositoryConfiguration) TableName() string

Jump to

Keyboard shortcuts

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