db

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Release

type Release struct {
	// ReleaseID Generated by the server when created
	ReleaseID string `json:"releaseId" gorm:"type:varchar(64);primary_key"`
	// ReleaseName Any string, easy for users to identify, the maximum length is 255, required
	ReleaseName string `json:"releaseName" gorm:"index:idx_release_name;not null"`
	// Desc Describe, optional
	Desc string `json:"desc" gorm:"type:text"`
	// Dice When ResourceType is diceyml, store dice.yml context, optional
	Dice string `json:"dice" gorm:"type:text"` // dice.yml
	// Addon When ResourceType is addonyml,store addon.yml context,optional
	Addon string `json:"addon" gorm:"type:text"`
	// Labels map type, the maximum length is 1000, optional
	Labels string `json:"labels" gorm:"type:varchar(1000)"`
	// Version store release version, only in the same company, same project and same application,the maximum length is 100,optional
	Version string `json:"version" gorm:"type:varchar(100)"`
	// OrgID Corporate identifier,optional
	OrgID int64 `json:"orgId" gorm:"index:idx_org_id"`
	// ProjectID Project identifier,optional
	ProjectID int64 `json:"projectId"`
	// ApplicationID Application identifier,optional
	ApplicationID int64 `json:"applicationId"`
	// ProjectName Project name,optional
	ProjectName string `json:"projectName" gorm:"type:varchar(80)"`
	// ApplicationName Application name,optional
	ApplicationName string `json:"applicationName" gorm:"type:varchar(80)"`
	// UserID User identifier,the maximum length is 50,optional
	UserID string `json:"userId" gorm:"type:varchar(50)"`
	// ClusterName Cluster Name,the maximum length is 80,optional
	ClusterName string `json:"clusterName" gorm:"type:varchar(80)"` // 所属集群
	// Resources Specify the release resource type and resource storage path, optional
	Resources string `json:"resources,omitempty" gorm:"type:text"`
	// Reference Number of deployments, when it is 0, can be clear
	Reference int64 `json:"reference"`
	// CrossCluster Indicates whether the current release can cross clusters, without cluster restrictions
	CrossCluster bool `json:"crossCluster"`
	// CreatedAt Release created time
	CreatedAt time.Time `json:"createdAt"`
	// UpdatedAt Release updated time
	UpdatedAt time.Time `json:"updatedAt"`
}

func (Release) TableName

func (Release) TableName() string

Set table name

type ReleaseConfigDB

type ReleaseConfigDB struct {
	*gorm.DB
}

ReleaseConfig .

func (*ReleaseConfigDB) CreateRelease

func (client *ReleaseConfigDB) CreateRelease(release *Release) error

CreateRelease Create Release

func (*ReleaseConfigDB) DeleteRelease

func (client *ReleaseConfigDB) DeleteRelease(releaseID string) error

DeleteRelease Delete Release

func (*ReleaseConfigDB) GetAppIDsByProjectAndVersion

func (client *ReleaseConfigDB) GetAppIDsByProjectAndVersion(projectID int64, version string) ([]int64, error)

GetAppIDsByProjectAndVersion Get appIDList by projectID & version

func (*ReleaseConfigDB) GetLatestReleaseByAppAndVersion

func (client *ReleaseConfigDB) GetLatestReleaseByAppAndVersion(appID int64, version string) (*Release, error)

GetLatestReleaseByAppAndVersion Get the latest release under the app

func (*ReleaseConfigDB) GetRelease

func (client *ReleaseConfigDB) GetRelease(releaseID string) (*Release, error)

GetRelease Get Release

func (*ReleaseConfigDB) GetReleaseNamesByApp

func (client *ReleaseConfigDB) GetReleaseNamesByApp(orgID, appID int64) ([]string, error)

GetReleaseNamesByApp Get releaseName list by appID

func (*ReleaseConfigDB) GetReleasesByAppAndVersion

func (client *ReleaseConfigDB) GetReleasesByAppAndVersion(orgID, projectID, appID int64, version string) ([]Release, error)

GetReleasesByAppAndVersion Get Release list by appID & version

func (*ReleaseConfigDB) GetReleasesByParams

func (client *ReleaseConfigDB) GetReleasesByParams(
	orgID, projectID, applicationID int64,
	keyword, releaseName, branch,
	cluster string, crossCluster string, isVersion bool, crossClusterOrSpecifyCluster string,
	startTime, endTime time.Time, pageNum, pageSize int64) (int64, []Release, error)

GetReleasesByParams filter Releases by parameters

func (*ReleaseConfigDB) GetUnReferedReleasesBefore

func (client *ReleaseConfigDB) GetUnReferedReleasesBefore(before time.Time) ([]Release, error)

GetUnReferedReleasesBefore Get the Release that has not been referenced before a given point in time

func (*ReleaseConfigDB) UpdateRelease

func (client *ReleaseConfigDB) UpdateRelease(release *Release) error

UpdateRelease Update Release

Jump to

Keyboard shortcuts

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