v2models

package
v0.0.34 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2022 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppVersion

type AppVersion struct {
	gorm.Model
	Chart      Chart
	ChartID    uint   `gorm:"not null: default:null"`
	AppVersion string `gorm:"not null: default:null"`
	GitCommit  string
	GitBranch  string
}

func (AppVersion) TableName

func (c AppVersion) TableName() string

type Chart

type Chart struct {
	gorm.Model
	Name string `gorm:"not null; default:null; unique"`
	// Mutable
	ChartRepo             *string `gorm:"not null; default:null"`
	AppImageGitRepo       *string
	AppImageGitMainBranch *string
}

func (Chart) TableName

func (c Chart) TableName() string

type ChartDeployRecord

type ChartDeployRecord struct {
	gorm.Model
	ChartRelease      ChartRelease
	ChartReleaseID    uint   `gorm:"not null; default:null"`
	ExactChartVersion string `gorm:"not null; default:null"`
	ExactAppVersion   string
	HelmfileRef       string `gorm:"not null; default:null"`
}

func (ChartDeployRecord) TableName

func (c ChartDeployRecord) TableName() string

type ChartRelease

type ChartRelease struct {
	gorm.Model
	Chart           Chart
	ChartID         uint
	Cluster         *Cluster
	ClusterID       *uint
	DestinationType string
	Environment     *Environment
	EnvironmentID   *uint
	Name            string `gorm:"not null; default:null; unique"`
	Namespace       string
	// Mutable
	CurrentAppVersionExact   *string
	CurrentChartVersionExact *string
	HelmfileRef              *string
	TargetAppVersionBranch   *string
	TargetAppVersionCommit   *string
	TargetAppVersionExact    *string
	TargetAppVersionUse      *string
	TargetChartVersionExact  *string
	TargetChartVersionUse    *string `gorm:"not null; default:null"`
	ThelmaMode               *string
}

func (ChartRelease) TableName

func (c ChartRelease) TableName() string

type ChartVersion

type ChartVersion struct {
	gorm.Model
	Chart        Chart
	ChartID      uint   `gorm:"not null: default:null"`
	ChartVersion string `gorm:"not null: default:null"`
}

func (ChartVersion) TableName

func (c ChartVersion) TableName() string

type Cluster

type Cluster struct {
	gorm.Model
	Name              string `gorm:"not null; default:null; unique"`
	Provider          string `gorm:"not null; default:null"`
	GoogleProject     string
	AzureSubscription string
	// Mutable
	Base                *string `gorm:"not null; default:null"`
	Address             *string `gorm:"not null; default:null"`
	RequiresSuitability *bool   `gorm:"not null; default:null"`
}

func (Cluster) TableName

func (c Cluster) TableName() string

type Environment

type Environment struct {
	gorm.Model
	Base                      string
	Lifecycle                 string `gorm:"not null; default:null"`
	Name                      string `gorm:"not null; default:null; unique"`
	TemplateEnvironment       *Environment
	TemplateEnvironmentID     *uint
	ValuesName                string
	ChartReleasesFromTemplate *bool
	// Mutable
	DefaultCluster      *Cluster
	DefaultClusterID    *uint
	DefaultNamespace    *string
	Owner               *string `gorm:"not null;default:null"`
	RequiresSuitability *bool
}

func (Environment) TableName

func (e Environment) TableName() string

type Model

type Model interface {
	TableName() string
}

type Store

type Store[M Model] struct {
	// contains filtered or unexported fields
}

func (Store[M]) Create

func (s Store[M]) Create(model M, user *auth.User) (M, error)

func (Store[M]) Delete

func (s Store[M]) Delete(selector string, user *auth.User) (M, error)

func (Store[M]) Edit

func (s Store[M]) Edit(selector string, editsToMake M, user *auth.User) (M, error)

func (Store[M]) Get

func (s Store[M]) Get(selector string) (M, error)

func (Store[M]) GetOtherValidSelectors

func (s Store[M]) GetOtherValidSelectors(selector string) ([]string, error)

GetOtherValidSelectors is basically just a human debug method. Different model types have different selectors to try to make it easier to refer to them than by having to directly query them and use their numeric ID primary key. Under the hood, models are already required to be able to generate selectors from an entry for uniqueness-validation purposes, so this is a simple method that uses that existing code to translate one selector for an existing entry into all possible selectors that would match.

func (Store[M]) ListAllMatching

func (s Store[M]) ListAllMatching(filter M, limit int) ([]M, error)

type StoreSet

type StoreSet struct {
	ClusterStore           *Store[Cluster]
	EnvironmentStore       *Store[Environment]
	ChartStore             *Store[Chart]
	ChartVersionStore      *Store[ChartVersion]
	AppVersionStore        *Store[AppVersion]
	ChartReleaseStore      *Store[ChartRelease]
	ChartDeployRecordStore *Store[ChartDeployRecord]
}

func NewStoreSet

func NewStoreSet(db *gorm.DB) *StoreSet

Jump to

Keyboard shortcuts

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