dbmodels

package
v0.0.0-...-ac2fcb2 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	AccessPolicyType = "access"
	AdminPolicyType  = "admin"
	CliJobAccessType = "cli_access"
)

Variables

View Source
var DriftStatusAcknowledgeDrift = "acknowledged drift"
View Source
var DriftStatusNewDrift = "new drift"
View Source
var DriftStatusNoDrift = "no drift"

Functions

func ConnectDatabase

func ConnectDatabase()

func CreateOrGetDiggerRepoForGithubRepo

func CreateOrGetDiggerRepoForGithubRepo(ghRepoFullName string, ghRepoOrganisation string, ghRepoName string, ghRepoUrl string, installationId string, githubAppId int64, accountId int64, login string, defaultBranch string, cloneUrl string) (*model.Repo, *model.Organisation, error)

Types

type Database

type Database struct {
	GormDB *gorm.DB
	Query  *models_generated.Query
}
var DB *Database

var DB *gorm.DB

func (*Database) CreateCiJobFromSpec

func (db *Database) CreateCiJobFromSpec(spec spec.Spec, runName string, projectId string) (*model.DiggerCiJob, error)

func (*Database) CreateDiggerJobToken

func (db *Database) CreateDiggerJobToken(organisationId string) (*model.DiggerCiJobToken, error)
func (db *Database) CreateGithubInstallationLink(orgId string, installationId string) (*model.GithubAppInstallationLink, error)

func (*Database) CreateProject

func (db *Database) CreateProject(name string, repo *model.Repo) (*model.Project, error)

func (*Database) CreateRepo

func (db *Database) CreateRepo(name string, repoFullName string, repoOrganisation string, repoName string, repoUrl string, org *model.Organisation, diggerConfig string, githubInstallationId string, githubAppId int64, accountId int64, login string, defaultBranch string, cloneUrl string) (*model.Repo, error)

func (*Database) GetDiggerCiJob

func (db *Database) GetDiggerCiJob(diggerJobId string) (*model.DiggerCiJob, error)
func (db *Database) GetGithubAppInstallationLink(installationId string) (*model.GithubAppInstallationLink, error)

GetGithubAppInstallationLink repoFullName should be in the following format: org/repo_name, for example "diggerhq/github-job-scheduler"

func (*Database) GetGithubInstallationLinkForInstallationId

func (db *Database) GetGithubInstallationLinkForInstallationId(installationId string) (*model.GithubAppInstallationLink, error)

func (*Database) GetJobToken

func (db *Database) GetJobToken(tenantId any) (*model.DiggerCiJobToken, error)

func (*Database) GetOrganisationById

func (db *Database) GetOrganisationById(orgId any) (*model.Organisation, error)

func (*Database) GetProjectById

func (db *Database) GetProjectById(projectId string) (*model.Project, error)

func (*Database) GetProjectByName

func (db *Database) GetProjectByName(orgId any, repo *model.Repo, name string) (*model.Project, error)

GetProjectByName return project for specified org and repo if record doesn't exist return nil

func (*Database) GetRepo

func (db *Database) GetRepo(orgIdKey any, repoName string) (*model.Repo, error)

GetRepo returns digger repo by organisationId and repo name (diggerhq-digger) it will return an empty object if record doesn't exist in database

func (*Database) GetRepoByInstllationIdAndRepoFullName

func (db *Database) GetRepoByInstllationIdAndRepoFullName(installationId string, repoFullName string) (*model.Repo, error)

GetGithubAppInstallationByIdAndRepo repoFullName should be in the following format: org/repo_name, for example "diggerhq/github-job-scheduler"

func (*Database) LoadProjectsForOrg

func (db *Database) LoadProjectsForOrg(orgId string) ([]*model.Project, error)

func (*Database) RefreshProjectsFromRepo

func (db *Database) RefreshProjectsFromRepo(orgId string, config configuration.DiggerConfigYaml, repo *model.Repo) error

func (*Database) UpdateDiggerJob

func (db *Database) UpdateDiggerJob(job *model.DiggerCiJob) error

type DiggerJobStatus

type DiggerJobStatus string
const (
	DiggerJobCreated      DiggerJobStatus = "created"
	DiggerJobTriggered    DiggerJobStatus = "triggered"
	DiggerJobFailed       DiggerJobStatus = "failed"
	DiggerJobStarted      DiggerJobStatus = "started"
	DiggerJobSucceeded    DiggerJobStatus = "succeeded"
	DiggerJobQueuedForRun DiggerJobStatus = "queued"
)

type DriftStatus

type DriftStatus string

type GithubAppInstallationLinkStatus

type GithubAppInstallationLinkStatus string
const (
	GithubAppInstallationLinkActive   GithubAppInstallationLinkStatus = "active"
	GithubAppInstallationLinkInactive GithubAppInstallationLinkStatus = "inactive"
)

Jump to

Keyboard shortcuts

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