Documentation ¶
Index ¶
- func WithRollbackStoreSet[T any](storeSet *StoreSet, f func(*StoreSet) (T, error)) (T, error)
- type AppVersion
- type Changeset
- type ChangesetEventStore
- type Chart
- type ChartRelease
- type ChartReleaseVersion
- type ChartVersion
- type Cluster
- type Environment
- type Model
- type ModelStore
- func (s ModelStore[M]) Create(model M, user *auth.User) (M, bool, error)
- func (s ModelStore[M]) Delete(selector string, user *auth.User) (M, error)
- func (s ModelStore[M]) Edit(selector string, editsToMake M, user *auth.User) (M, error)
- func (s ModelStore[M]) Get(selector string) (M, error)
- func (s ModelStore[M]) GetOtherValidSelectors(selector string) ([]string, error)
- func (s ModelStore[M]) ListAllMatching(filter M, limit int) ([]M, error)
- type StoreSet
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WithRollbackStoreSet ¶ added in v0.0.50
WithRollbackStoreSet is a last-resort for achieving reasonable error behavior outside the model. Functions inside the model will reasonably rollback when they encounter an error. This function is intended to be used when a controller composes model functions together and needs to rollback the entire composition when an error occurs in any of them.
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 Description string ParentAppVersion *AppVersion ParentAppVersionID *uint }
func (AppVersion) TableName ¶
func (c AppVersion) TableName() string
type Changeset ¶ added in v0.0.50
type Changeset struct { gorm.Model ChartRelease *ChartRelease ChartReleaseID uint From ChartReleaseVersion `gorm:"embedded;embeddedPrefix:from_"` To ChartReleaseVersion `gorm:"embedded;embeddedPrefix:to_"` AppliedAt *time.Time SupersededAt *time.Time NewAppVersions []*AppVersion `gorm:"many2many:v2_changeset_new_app_versions;constraint:OnDelete:CASCADE,OnUpdate:CASCADE;"` NewChartVersions []*ChartVersion `gorm:"many2many:v2_changeset_new_chart_versions;constraint:OnDelete:CASCADE,OnUpdate:CASCADE;"` }
type ChangesetEventStore ¶ added in v0.0.50
type ChangesetEventStore struct { *ModelStore[Changeset] // contains filtered or unexported fields }
func (*ChangesetEventStore) PlanAndApply ¶ added in v0.0.50
type Chart ¶
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 ChartReleaseVersion Subdomain *string Protocol *string Port *uint }
func (ChartRelease) TableName ¶
func (c ChartRelease) TableName() string
type ChartReleaseVersion ¶ added in v0.0.50
type ChartReleaseVersion struct { ResolvedAt *time.Time AppVersionResolver *string AppVersionExact *string AppVersionBranch *string AppVersionCommit *string AppVersion *AppVersion AppVersionID *uint ChartVersionResolver *string ChartVersionExact *string ChartVersion *ChartVersion ChartVersionID *uint HelmfileRef *string }
ChartReleaseVersion isn't stored in the database on its own, it is included as a part of a ChartRelease or Changeset. It has especially strict validation that requires it being fully loaded from the database. The resolve method will help "load" it fully from the database so it can survive validation.
type ChartVersion ¶
type ChartVersion struct { gorm.Model Chart *Chart ChartID uint `gorm:"not null: default:null"` ChartVersion string `gorm:"not null: default:null"` Description string ParentChartVersion *ChartVersion ParentChartVersionID *uint }
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"` }
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 BaseDomain *string NamePrefixesDomain *bool }
func (Environment) TableName ¶
func (e Environment) TableName() string
type ModelStore ¶ added in v0.0.50
type ModelStore[M Model] struct { // contains filtered or unexported fields }
func (ModelStore[M]) Create ¶ added in v0.0.50
func (s ModelStore[M]) Create(model M, user *auth.User) (M, bool, error)
func (ModelStore[M]) Delete ¶ added in v0.0.50
func (s ModelStore[M]) Delete(selector string, user *auth.User) (M, error)
func (ModelStore[M]) Edit ¶ added in v0.0.50
func (s ModelStore[M]) Edit(selector string, editsToMake M, user *auth.User) (M, error)
func (ModelStore[M]) Get ¶ added in v0.0.50
func (s ModelStore[M]) Get(selector string) (M, error)
func (ModelStore[M]) GetOtherValidSelectors ¶ added in v0.0.50
func (s ModelStore[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 (ModelStore[M]) ListAllMatching ¶ added in v0.0.50
func (s ModelStore[M]) ListAllMatching(filter M, limit int) ([]M, error)
type StoreSet ¶
type StoreSet struct { ClusterStore *ModelStore[Cluster] EnvironmentStore *ModelStore[Environment] ChartStore *ModelStore[Chart] ChartVersionStore *ModelStore[ChartVersion] AppVersionStore *ModelStore[AppVersion] ChartReleaseStore *ModelStore[ChartRelease] ChangesetEventStore *ChangesetEventStore // contains filtered or unexported fields }