models

package
v0.0.0-...-7d3b672 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GithubAccessToken

type GithubAccessToken struct {
	helper.AccessToken `mapstructure:",squash"`
	// contains filtered or unexported fields
}

GithubAccessToken supports fetching data with multiple tokens

func (*GithubAccessToken) GetTokensCount

func (gat *GithubAccessToken) GetTokensCount() int

type GithubAccount

type GithubAccount struct {
	ConnectionId uint64 `gorm:"primaryKey"`
	Id           int    `json:"id" gorm:"primaryKey;autoIncrement:false"`
	Login        string `json:"login" gorm:"type:varchar(255)"`
	Name         string `json:"name" gorm:"type:varchar(255)"`
	Company      string `json:"company" gorm:"type:varchar(255)"`
	Email        string `json:"Email" gorm:"type:varchar(255)"`
	AvatarUrl    string `json:"avatar_url" gorm:"type:varchar(255)"`
	Url          string `json:"url" gorm:"type:varchar(255)"`
	HtmlUrl      string `json:"html_url" gorm:"type:varchar(255)"`
	Type         string `json:"type" gorm:"type:varchar(255)"`
	common.NoPKModel
}

func (GithubAccount) TableName

func (GithubAccount) TableName() string

type GithubAccountOrg

type GithubAccountOrg struct {
	ConnectionId uint64 `gorm:"primaryKey"`
	AccountId    int    `gorm:"primaryKey;autoIncrement:false"`
	OrgId        int    `gorm:"primaryKey;autoIncrement:false"`
	OrgLogin     string `json:"org_login" gorm:"type:varchar(255)"`
	common.NoPKModel
}

func (GithubAccountOrg) TableName

func (GithubAccountOrg) TableName() string

type GithubApiParams

type GithubApiParams struct {
	ConnectionId uint64
	Name         string
}

type GithubApp

type GithubApp struct {
	ID   int32  `json:"id"`
	Slug string `json:"slug"`
}

type GithubAppInstallation

type GithubAppInstallation struct {
	Id      int `json:"id"`
	Account struct {
		Login string `json:"login"`
	} `json:"account"`
}

type GithubAppInstallationWithToken

type GithubAppInstallationWithToken struct {
	GithubAppInstallation
	Token string
}

type GithubAppKey

type GithubAppKey struct {
	helper.AppKey  `mapstructure:",squash"`
	InstallationID int `mapstructure:"installationId" validate:"required" json:"installationId"`
}

func (*GithubAppKey) CreateJwt

func (gak *GithubAppKey) CreateJwt() (string, errors.Error)

type GithubCommit

type GithubCommit struct {
	Sha            string `gorm:"primaryKey;type:varchar(40)"`
	AuthorId       int
	AuthorName     string `gorm:"type:varchar(255)"`
	AuthorEmail    string `gorm:"type:varchar(255)"`
	AuthoredDate   time.Time
	CommitterId    int
	CommitterName  string `gorm:"type:varchar(255)"`
	CommitterEmail string `gorm:"type:varchar(255)"`
	CommittedDate  time.Time
	Message        string
	Url            string `gorm:"type:varchar(255)"`
	Additions      int    `gorm:"comment:Added lines of code"`
	Deletions      int    `gorm:"comment:Deleted lines of code"`
	common.NoPKModel
}

func (GithubCommit) TableName

func (GithubCommit) TableName() string

type GithubCommitStat

type GithubCommitStat struct {
	ConnectionId uint64 `gorm:"primaryKey"`
	Sha          string `gorm:"primaryKey;type:varchar(40)"`
	Additions    int    `gorm:"comment:Added lines of code"`
	Deletions    int    `gorm:"comment:Deleted lines of code"`

	CommittedDate time.Time `gorm:"index"`
	common.NoPKModel
}

func (GithubCommitStat) TableName

func (GithubCommitStat) TableName() string

type GithubConn

type GithubConn struct {
	helper.RestConnection `mapstructure:",squash"`
	helper.MultiAuth      `mapstructure:",squash"`
	GithubAccessToken     `mapstructure:",squash" authMethod:"AccessToken"`
	GithubAppKey          `mapstructure:",squash" authMethod:"AppKey"`
}

GithubConn holds the essential information to connect to the Github API

func (*GithubConn) PrepareApiClient

func (conn *GithubConn) PrepareApiClient(apiClient apihelperabstract.ApiClientAbstract) errors.Error

PrepareApiClient splits Token to tokens for SetupAuthentication to utilize

func (*GithubConn) SetupAuthentication

func (conn *GithubConn) SetupAuthentication(req *http.Request) errors.Error

SetupAuthentication sets up the HTTP Request Authentication

type GithubConnection

type GithubConnection struct {
	helper.BaseConnection `mapstructure:",squash"`
	GithubConn            `mapstructure:",squash"`
	EnableGraphql         bool `mapstructure:"enableGraphql" json:"enableGraphql"`
}

GithubConnection holds GithubConn plus ID/Name for database storage

func (GithubConnection) TableName

func (GithubConnection) TableName() string

type GithubIssue

type GithubIssue struct {
	ConnectionId    uint64 `gorm:"primaryKey"`
	GithubId        int    `gorm:"primaryKey"`
	RepoId          int    `gorm:"index"`
	Number          int    `gorm:"index;comment:Used in API requests ex. api/repo/1/issue/<THIS_NUMBER>"`
	State           string `gorm:"type:varchar(255)"`
	Title           string
	Body            string
	Priority        string `gorm:"type:varchar(255)"`
	Type            string `gorm:"type:varchar(100)"`
	StdType         string `gorm:"type:varchar(100)"`
	AuthorId        int
	AuthorName      string `gorm:"type:varchar(255)"`
	AssigneeId      int
	AssigneeName    string `gorm:"type:varchar(255)"`
	MilestoneId     int    `gorm:"index"`
	LeadTimeMinutes uint
	Url             string `gorm:"type:varchar(255)"`
	ClosedAt        *time.Time
	GithubCreatedAt time.Time
	GithubUpdatedAt time.Time `gorm:"index"`
	Severity        string    `gorm:"type:varchar(255)"`
	Component       string    `gorm:"type:varchar(255)"`
	common.NoPKModel
}

func (GithubIssue) TableName

func (GithubIssue) TableName() string

type GithubIssueAssignee

type GithubIssueAssignee struct {
	common.NoPKModel
	ConnectionId uint64 `gorm:"primaryKey"`
	IssueId      int    `gorm:"primaryKey"`
	RepoId       int    `gorm:"primaryKey"`
	AssigneeId   int    `gorm:"primaryKey"`
	AssigneeName string `gorm:"type:varchar(255)"`
}

func (GithubIssueAssignee) TableName

func (GithubIssueAssignee) TableName() string

type GithubIssueComment

type GithubIssueComment struct {
	ConnectionId    uint64 `gorm:"primaryKey"`
	GithubId        int    `gorm:"primaryKey"`
	IssueId         int    `gorm:"index;comment:References the Issue"`
	Body            string
	AuthorUsername  string `gorm:"type:varchar(255)"`
	AuthorUserId    int
	GithubCreatedAt time.Time
	GithubUpdatedAt time.Time `gorm:"index"`
	common.NoPKModel
}

func (GithubIssueComment) TableName

func (GithubIssueComment) TableName() string

type GithubIssueEvent

type GithubIssueEvent struct {
	ConnectionId    uint64    `gorm:"primaryKey"`
	GithubId        int       `gorm:"primaryKey"`
	IssueId         int       `gorm:"index;comment:References the Issue"`
	Type            string    `gorm:"type:varchar(255);comment:Events that can occur to an issue, ex. assigned, closed, labeled, etc."`
	AuthorUsername  string    `gorm:"type:varchar(255)"`
	GithubCreatedAt time.Time `gorm:"index"`
	common.NoPKModel
}

func (GithubIssueEvent) TableName

func (GithubIssueEvent) TableName() string

type GithubIssueLabel

type GithubIssueLabel struct {
	ConnectionId uint64 `gorm:"primaryKey"`
	IssueId      int    `gorm:"primaryKey;autoIncrement:false"`
	LabelName    string `gorm:"primaryKey;type:varchar(255)"`
	common.NoPKModel
}

func (GithubIssueLabel) TableName

func (GithubIssueLabel) TableName() string

type GithubJob

type GithubJob struct {
	common.NoPKModel
	ConnectionId  uint64         `gorm:"primaryKey"`
	RepoId        int            `gorm:"primaryKey"`
	ID            int            `json:"id" gorm:"primaryKey;autoIncrement:false"`
	RunID         int            `json:"run_id"`
	RunURL        string         `json:"run_url" gorm:"type:varchar(255)"`
	NodeID        string         `json:"node_id" gorm:"type:varchar(255)"`
	HeadSha       string         `json:"head_sha" gorm:"type:varchar(255)"`
	URL           string         `json:"url" gorm:"type:varchar(255)"`
	HTMLURL       string         `json:"html_url" gorm:"type:varchar(255)"`
	Status        string         `json:"status" gorm:"type:varchar(255)"`
	Conclusion    string         `json:"conclusion" gorm:"type:varchar(255)"`
	StartedAt     *time.Time     `json:"started_at"`
	CompletedAt   *time.Time     `json:"completed_at"`
	Name          string         `json:"name" gorm:"type:varchar(255)"`
	Steps         datatypes.JSON `json:"steps"`
	CheckRunURL   string         `json:"check_run_url" gorm:"type:varchar(255)"`
	Labels        datatypes.JSON `json:"labels"`
	RunnerID      int            `json:"runner_id"`
	RunnerName    string         `json:"runner_name" gorm:"type:varchar(255)"`
	RunnerGroupID int            `json:"runner_group_id"`
	Type          string         `json:"type" gorm:"type:varchar(255)"`
	Environment   string         `gorm:"type:varchar(255)"`
}

func (GithubJob) TableName

func (GithubJob) TableName() string

type GithubMilestone

type GithubMilestone struct {
	ConnectionId uint64 `gorm:"primaryKey"`
	MilestoneId  int    `gorm:"primaryKey;autoIncrement:false"`
	RepoId       int
	Number       int
	URL          string
	Title        string
	OpenIssues   int
	ClosedIssues int
	State        string
	CreatedAt    time.Time
	UpdatedAt    time.Time
	ClosedAt     *time.Time
	common.NoPKModel
}

func (GithubMilestone) TableName

func (GithubMilestone) TableName() string

type GithubPrComment

type GithubPrComment struct {
	ConnectionId    uint64 `gorm:"primaryKey"`
	GithubId        int    `gorm:"primaryKey"`
	PullRequestId   int    `gorm:"index"`
	Body            string
	AuthorUsername  string `gorm:"type:varchar(255)"`
	AuthorUserId    int
	CommitSha       string `gorm:"type:varchar(255)"`
	GithubCreatedAt time.Time
	GithubUpdatedAt time.Time `gorm:"index"`
	ReviewId        int
	Type            string `gorm:"index;type:varchar(255)"`
	common.NoPKModel
}

func (GithubPrComment) TableName

func (GithubPrComment) TableName() string

type GithubPrCommit

type GithubPrCommit struct {
	ConnectionId       uint64 `gorm:"primaryKey"`
	CommitSha          string `gorm:"primaryKey;type:varchar(40)"`
	PullRequestId      int    `gorm:"primaryKey;autoIncrement:false"`
	CommitAuthorName   string `gorm:"type:varchar(255)"` // Author name
	CommitAuthorEmail  string `gorm:"type:varchar(255)"` // Author email
	CommitAuthoredDate time.Time
	common.NoPKModel
}

func (GithubPrCommit) TableName

func (GithubPrCommit) TableName() string

type GithubPrIssue

type GithubPrIssue struct {
	ConnectionId      uint64 `gorm:"primaryKey"`
	PullRequestId     int    `gorm:"primaryKey"`
	IssueId           int    `gorm:"primaryKey"`
	PullRequestNumber int
	IssueNumber       int
	common.NoPKModel
}

func (GithubPrIssue) TableName

func (GithubPrIssue) TableName() string

type GithubPrLabel

type GithubPrLabel struct {
	ConnectionId uint64 `gorm:"primaryKey"`
	PullId       int    `gorm:"primaryKey;autoIncrement:false"`
	LabelName    string `gorm:"primaryKey;type:varchar(255)"`
	common.NoPKModel
}

func (GithubPrLabel) TableName

func (GithubPrLabel) TableName() string

type GithubPrReview

type GithubPrReview struct {
	ConnectionId   uint64 `gorm:"primaryKey"`
	GithubId       int    `gorm:"primaryKey"`
	PullRequestId  int    `gorm:"index"`
	Body           string
	AuthorUsername string `gorm:"type:varchar(255)"`
	AuthorUserId   int
	CommitSha      string
	GithubSubmitAt *time.Time
	State          string
	common.NoPKModel
}

func (GithubPrReview) TableName

func (GithubPrReview) TableName() string

type GithubPullRequest

type GithubPullRequest struct {
	ConnectionId    uint64 `gorm:"primaryKey"`
	GithubId        int    `gorm:"primaryKey"`
	RepoId          int    `gorm:"index"`
	HeadRepoId      int
	Number          int    `gorm:"index"` // This number is used in GET requests to the API associated to reviewers / comments / etc.
	State           string `gorm:"type:varchar(255)"`
	Title           string
	GithubCreatedAt time.Time
	GithubUpdatedAt time.Time `gorm:"index"`
	ClosedAt        *time.Time
	// In order to get the following fields, we need to collect PRs individually from GitHub
	Additions      int
	Deletions      int
	Comments       int
	Commits        int
	ReviewComments int
	Merged         bool
	MergedAt       *time.Time
	Body           string
	Type           string `gorm:"type:varchar(255)"`
	Component      string `gorm:"type:varchar(255)"`
	MergeCommitSha string `gorm:"type:varchar(40)"`
	HeadRef        string `gorm:"type:varchar(255)"`
	BaseRef        string `gorm:"type:varchar(255)"`
	BaseCommitSha  string `gorm:"type:varchar(255)"`
	HeadCommitSha  string `gorm:"type:varchar(255)"`
	Url            string `gorm:"type:varchar(255)"`
	AuthorName     string `gorm:"type:varchar(100)"`
	AuthorId       int
	common.NoPKModel
}

func (GithubPullRequest) TableName

func (GithubPullRequest) TableName() string

type GithubRepo

type GithubRepo struct {
	ConnectionId     uint64     `json:"connectionId" gorm:"primaryKey" validate:"required" mapstructure:"connectionId,omitempty"`
	GithubId         int        `json:"githubId" gorm:"primaryKey" validate:"required" mapstructure:"githubId"`
	Name             string     `json:"name" gorm:"type:varchar(255)" mapstructure:"name,omitempty"`
	FullName         string     `json:"fullName" gorm:"type:varchar(255)" mapstructure:"fullName,omitempty"`
	HTMLUrl          string     `json:"HTMLUrl" gorm:"type:varchar(255)" mapstructure:"HTMLUrl,omitempty"`
	Description      string     `json:"description" mapstructure:"description,omitempty"`
	ScopeConfigId    uint64     `json:"scopeConfigId,omitempty" mapstructure:"scopeConfigId,omitempty"`
	OwnerId          int        `json:"ownerId" mapstructure:"ownerId,omitempty"`
	Language         string     `json:"language" gorm:"type:varchar(255)" mapstructure:"language,omitempty"`
	ParentGithubId   int        `json:"parentId" mapstructure:"parentGithubId,omitempty"`
	ParentHTMLUrl    string     `json:"parentHtmlUrl" mapstructure:"parentHtmlUrl,omitempty"`
	CloneUrl         string     `json:"cloneUrl" gorm:"type:varchar(255)" mapstructure:"cloneUrl,omitempty"`
	CreatedDate      *time.Time `json:"createdDate" mapstructure:"-"`
	UpdatedDate      *time.Time `json:"updatedDate" mapstructure:"-"`
	common.NoPKModel `json:"-" mapstructure:"-"`
}

func (GithubRepo) ScopeId

func (r GithubRepo) ScopeId() string

func (GithubRepo) ScopeName

func (r GithubRepo) ScopeName() string

func (GithubRepo) ScopeParams

func (r GithubRepo) ScopeParams() interface{}

func (GithubRepo) TableName

func (GithubRepo) TableName() string

type GithubRepoAccount

type GithubRepoAccount struct {
	ConnectionId uint64 `gorm:"primaryKey"`
	AccountId    int    `gorm:"primaryKey;autoIncrement:false"`
	RepoGithubId int    `gorm:"primaryKey;autoIncrement:false"`
	Login        string `json:"login" gorm:"type:varchar(255)"`
	common.NoPKModel
}

func (GithubRepoAccount) TableName

func (GithubRepoAccount) TableName() string

type GithubRepoCommit

type GithubRepoCommit struct {
	ConnectionId uint64 `gorm:"primaryKey"`
	RepoId       int    `gorm:"primaryKey"`
	CommitSha    string `gorm:"primaryKey;type:varchar(40)"`
	common.NoPKModel
}

func (GithubRepoCommit) TableName

func (GithubRepoCommit) TableName() string

type GithubReviewer

type GithubReviewer struct {
	ConnectionId  uint64 `gorm:"primaryKey"`
	GithubId      int    `gorm:"primaryKey"`
	Login         string `gorm:"type:varchar(255)"`
	PullRequestId int    `gorm:"primaryKey"`

	common.NoPKModel
}

func (GithubReviewer) TableName

func (GithubReviewer) TableName() string

type GithubRun

type GithubRun struct {
	common.NoPKModel
	ConnectionId     uint64     `gorm:"primaryKey"`
	RepoId           int        `gorm:"primaryKey"`
	ID               int        `json:"id" gorm:"primaryKey;autoIncrement:false"`
	Name             string     `json:"name" gorm:"type:text"`
	NodeID           string     `json:"node_id" gorm:"type:varchar(255)"`
	HeadBranch       string     `json:"head_branch" gorm:"type:varchar(255)"`
	HeadSha          string     `json:"head_sha" gorm:"type:varchar(255)"`
	Path             string     `json:"path" gorm:"type:varchar(255)"`
	RunNumber        int        `json:"run_number"`
	Event            string     `json:"event" gorm:"type:varchar(255)"`
	Status           string     `json:"status" gorm:"type:varchar(255)"`
	Conclusion       string     `json:"conclusion" gorm:"type:varchar(255)"`
	WorkflowID       int        `json:"workflow_id"`
	CheckSuiteID     int64      `json:"check_suite_id"`
	CheckSuiteNodeID string     `json:"check_suite_node_id" gorm:"type:varchar(255)"`
	URL              string     `json:"url" gorm:"type:varchar(255)"`
	HTMLURL          string     `json:"html_url" gorm:"type:varchar(255)"`
	GithubCreatedAt  *time.Time `json:"created_at"`
	GithubUpdatedAt  *time.Time `json:"updated_at"`
	RunAttempt       int        `json:"run_attempt"`
	RunStartedAt     *time.Time `json:"run_started_at"`
	JobsURL          string     `json:"jobs_url" gorm:"type:varchar(255)"`
	LogsURL          string     `json:"logs_url" gorm:"type:varchar(255)"`
	CheckSuiteURL    string     `json:"check_suite_url" gorm:"type:varchar(255)"`
	ArtifactsURL     string     `json:"artifacts_url" gorm:"type:varchar(255)"`
	CancelURL        string     `json:"cancel_url" gorm:"type:varchar(255)"`
	RerunURL         string     `json:"rerun_url" gorm:"type:varchar(255)"`
	WorkflowURL      string     `json:"workflow_url" gorm:"type:varchar(255)"`
	Type             string     `json:"type" gorm:"type:varchar(255)"`
	Environment      string     `gorm:"type:varchar(255)"`
}

func (GithubRun) TableName

func (GithubRun) TableName() string

type GithubScopeConfig

type GithubScopeConfig struct {
	common.ScopeConfig   `mapstructure:",squash" json:",inline" gorm:"embedded"`
	ConnectionId         uint64            `mapstructure:"connectionId" json:"connectionId"`
	Name                 string            `mapstructure:"name" json:"name" gorm:"type:varchar(255);index:idx_name_github,unique" validate:"required"`
	PrType               string            `mapstructure:"prType,omitempty" json:"prType" gorm:"type:varchar(255)"`
	PrComponent          string            `mapstructure:"prComponent,omitempty" json:"prComponent" gorm:"type:varchar(255)"`
	PrBodyClosePattern   string            `mapstructure:"prBodyClosePattern,omitempty" json:"prBodyClosePattern" gorm:"type:varchar(255)"`
	IssueSeverity        string            `mapstructure:"issueSeverity,omitempty" json:"issueSeverity" gorm:"type:varchar(255)"`
	IssuePriority        string            `mapstructure:"issuePriority,omitempty" json:"issuePriority" gorm:"type:varchar(255)"`
	IssueComponent       string            `mapstructure:"issueComponent,omitempty" json:"issueComponent" gorm:"type:varchar(255)"`
	IssueTypeBug         string            `mapstructure:"issueTypeBug,omitempty" json:"issueTypeBug" gorm:"type:varchar(255)"`
	IssueTypeIncident    string            `mapstructure:"issueTypeIncident,omitempty" json:"issueTypeIncident" gorm:"type:varchar(255)"`
	IssueTypeRequirement string            `mapstructure:"issueTypeRequirement,omitempty" json:"issueTypeRequirement" gorm:"type:varchar(255)"`
	DeploymentPattern    string            `mapstructure:"deploymentPattern,omitempty" json:"deploymentPattern" gorm:"type:varchar(255)"`
	ProductionPattern    string            `mapstructure:"productionPattern,omitempty" json:"productionPattern" gorm:"type:varchar(255)"`
	Refdiff              datatypes.JSONMap `mapstructure:"refdiff,omitempty" json:"refdiff" swaggertype:"object" format:"json"`
}

func (GithubScopeConfig) TableName

func (GithubScopeConfig) TableName() string

type GithubUserOfToken

type GithubUserOfToken struct {
	Login string `json:"login"`
}

Using GithubUserOfToken because it requires authentication, and it is public information anyway.

type InstallationToken

type InstallationToken struct {
	Token string `json:"token"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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