models

package
v0.0.0-...-e0271d0 Latest Latest
Warning

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

Go to latest
Published: May 29, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package models contains the ORM layer

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MigrateAll

func MigrateAll() error

MigrateAll runs default migrations for all referenced models.

func ValidateExpectedMetadataKeysAreProvided

func ValidateExpectedMetadataKeysAreProvided(
	qmd *QualityMilestoneDefinition,
	metadata []QualityMilestoneMetadata,
) error

ValidateExpectedMetadataKeysAreProvided checks that all required metadata keys are provided and no unexpected keys were passed.

Types

type QualityMilestone

type QualityMilestone struct {
	gorm.Model
	Approver                     string
	Metadata                     []QualityMilestoneMetadata
	QualityMilestoneDefinition   QualityMilestoneDefinition
	Release                      Release
	QualityMilestoneDefinitionID uint
	ReleaseID                    uint
}

QualityMilestone is the progress marker within the release process.

func ApproveQualityMilestone

func ApproveQualityMilestone(
	validApproverDomain, tag, milestoneName, approver string, metadata []QualityMilestoneMetadata,
) (*QualityMilestone, error)

ApproveQualityMilestone approves a given Release for a given QualityMilestone.

type QualityMilestoneDefinition

type QualityMilestoneDefinition struct {
	gorm.Model
	Name                 string
	ExpectedMetadataKeys []string `gorm:"serializer:json"`
}

QualityMilestoneDefinition is the template for QualityMilestones within the release process.

func CreateQualityMilestoneDefinition

func CreateQualityMilestoneDefinition(name string, expectedMetadataKeys []string) (*QualityMilestoneDefinition, error)

CreateQualityMilestoneDefinition creates a new QualityMilestoneDefinition.

func GetQualityMilestoneDefinition

func GetQualityMilestoneDefinition(name string) (*QualityMilestoneDefinition, error)

GetQualityMilestoneDefinition returns a QualityMilestoneDefinition for the given name.

func ListQualityMilestoneDefinitions

func ListQualityMilestoneDefinitions() ([]QualityMilestoneDefinition, error)

ListQualityMilestoneDefinitions returns all known QualityMilestoneDefinitions.

type QualityMilestoneMetadata

type QualityMilestoneMetadata struct {
	gorm.Model
	Key                string
	Value              string
	QualityMilestone   QualityMilestone
	QualityMilestoneID uint
}

QualityMilestoneMetadata is a key-value struct that can be attached to QualityMilestones.

type Release

type Release struct {
	gorm.Model
	Tag               string
	Commit            string
	Creator           string
	Metadata          []ReleaseMetadata
	QualityMilestones []QualityMilestone
	Kind              version.Kind
	Rejected          bool
}

Release is the main citizen of the registry.

func CreateRelease

func CreateRelease(
	validCreatorDomain, tag, commit, creator string, metadata []ReleaseMetadata,
) (*Release, error)

CreateRelease creates a new Release based on based information.

func FindLatestRelaseWithPrefixAtQualityMilestone

func FindLatestRelaseWithPrefixAtQualityMilestone(
	prefix, qualityMilestoneName string,
	ignoredKinds []version.Kind,
	preload, includeRejected bool,
) (*Release, error)

FindLatestRelaseWithPrefixAtQualityMilestone returns the latest Release with a prefix at a QualityMilestone, sorted by semantic versioning.

func FindLatestRelease

func FindLatestRelease(ignoredKinds []version.Kind, preload, includeRejected bool) (*Release, error)

FindLatestRelease returns the latest Release overall, sorted by semantic versioning.

func FindLatestReleaseAtQualityMilestone

func FindLatestReleaseAtQualityMilestone(
	qualityMilestoneName string,
	ignoredKinds []version.Kind,
	preload, includeRejected bool,
) (*Release, error)

FindLatestReleaseAtQualityMilestone returns the latest Release at a QualityMilestone, sorted by semantic versioning.

func FindLatestReleaseWithPrefix

func FindLatestReleaseWithPrefix(
	prefix string,
	ignoredKinds []version.Kind,
	preload, includeRejected bool,
) (*Release, error)

FindLatestReleaseWithPrefix returns the latest Release with a prefix, sorted by semantic versioning.

func GetRelease

func GetRelease(tag string, preload, includeRejected bool) (*Release, error)

GetRelease returns a Release to a tag.

func ListAllReleases

func ListAllReleases(ignoredKinds []version.Kind, preload bool, includeRejected bool) ([]Release, error)

ListAllReleases returns all known Releases.

func ListAllReleasesAtQualityMilestone

func ListAllReleasesAtQualityMilestone(qualityMilestoneName string, ignoredKinds []version.Kind, preload, includeRejected bool) ([]Release, error)

ListAllReleasesAtQualityMilestone returns all Releases that have reached a specific QualityMilestone.

func ListAllReleasesWithPrefix

func ListAllReleasesWithPrefix(
	prefix string,
	ignoredKinds []version.Kind,
	preload, includeRejected bool,
) ([]Release, error)

ListAllReleasesWithPrefix implements search to return all Releases starting with a specific prefix.

func ListAllReleasesWithPrefixAtQualityMilestone

func ListAllReleasesWithPrefixAtQualityMilestone(
	prefix, qualityMilestoneName string,
	ignoredKinds []version.Kind,
	preload, includeRejected bool,
) ([]Release, error)

ListAllReleasesWithPrefixAtQualityMilestone implements search to return all Releases starting with a specific prefix at a specific QualityMilestone.

func RejectRelease

func RejectRelease(tag string, preload bool) (*Release, error)

RejectRelease rejects a release identified by tag.

func UpdateRelease

func UpdateRelease(tag string, newMetadata []ReleaseMetadata, includeRejected bool) (*Release, error)

UpdateRelease updates the metadata for a release identified by a tag.

type ReleaseMetadata

type ReleaseMetadata struct {
	gorm.Model
	Key       string
	Value     string
	Release   Release
	ReleaseID uint
}

ReleaseMetadata is a key-value struct that can be attached to Releases.

Jump to

Keyboard shortcuts

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