Versions in this module Expand all Collapse all v0 v0.3.0 Apr 17, 2021 Changes in this version + func MapError(err error) error v0.2.3 Jun 14, 2020 v0.2.2 Dec 19, 2019 v0.2.1 Nov 6, 2019 Changes in this version + var AllCapabilities = []Capability + var OAuthExpiration = 10 * time.Minute + var TokenCryptKey = []byte + func MakeStatus(res, set bool) *bool + func MakeTime(ts *timestamp.Timestamp, nullable bool) *time.Time + func MakeTimestamp(t *time.Time) *timestamp.Timestamp + func MakeUserList(users []*User) []*types.User + type Capability string + const CapabilityCancel + const CapabilityModifyCI + const CapabilityModifyUser + const CapabilitySubmit + type Model struct + func New(sqlURL string) (*Model, error) + func (m *Model) AddCapabilityToUser(u *User, cap Capability) error + func (m *Model) AddSubscriptionsForUser(u *User, repos []*Repository) error + func (m *Model) AssignRepository(repo *Repository, owner *User) error + func (m *Model) CancelRefByName(repoID int64, refName, baseURL string, gh github.Client) error + func (m *Model) CancelRun(runID int64, baseURL string, gh github.Client) error + func (m *Model) CancelSubmissionByID(id int64, baseURL string, client github.Client) error + func (m *Model) CancelTask(task *Task, baseURL string, gh github.Client) error + func (m *Model) CancelTaskByID(id int64, baseURL string, gh github.Client) error + func (m *Model) CancelTasksForPR(repository string, prID int64, baseURL string) error + func (m *Model) CountRunsForTask(id int64) (int64, error) + func (m *Model) CountTasks(repository, sha string) (int64, error) + func (m *Model) CreateUser(username string, token *topTypes.OAuthToken) (*User, error) + func (m *Model) DeleteError(u *User, id int64) error + func (m *Model) DeleteToken(name string) error + func (m *Model) DisableRepository(repo *Repository) error + func (m *Model) EnableRepository(repo *Repository, owner *User) error + func (m *Model) FindUserByID(id int64) (*User, error) + func (m *Model) FindUserByName(username string) (*User, error) + func (m *Model) FindUserByNameWithSubscriptions(username, search string) (*User, error) + func (m *Model) GetAllPublicRepos(search string) (RepositoryList, error) + func (m *Model) GetCancelForRun(runID int64) (bool, error) + func (m *Model) GetCapabilities(u *User, fixedCaps map[string][]string) ([]Capability, error) + func (m *Model) GetOwnedRepos(u *User, search string) (RepositoryList, error) + func (m *Model) GetPrivateReposForUser(u *User, search string) (RepositoryList, error) + func (m *Model) GetRefByNameAndSHA(repoName string, sha string) (*Ref, error) + func (m *Model) GetRepositoryByName(name string) (*Repository, error) + func (m *Model) GetRepositoryByNameForUser(name string, u *User) (*Repository, error) + func (m *Model) GetRunsForTask(id, page, perPage int64) ([]*Run, error) + func (m *Model) GetSubmissionByID(id int64) (*Submission, error) + func (m *Model) GetToken(name string) (string, error) + func (m *Model) GetVisibleReposForUser(u *User, search string) (RepositoryList, error) + func (m *Model) HasCapability(u *User, cap Capability, fixedCaps map[string][]string) (bool, error) + func (m *Model) ListSubscribedTasksForUser(userID, page, perPage int64) ([]*Task, error) + func (m *Model) ListTasks(repository, sha string, page, perPage int64) ([]*Task, error) + func (m *Model) LoadSession(id string) (*Session, error) + func (m *Model) NewSubmissionFromMessage(sub *types.Submission) (*Submission, error) + func (m *Model) NextQueueItem(runningOn string, queueName string) (*QueueItem, error) + func (m *Model) OAuthRegisterState(state string, scopes []string) error + func (m *Model) OAuthValidateState(state string) (*OAuth, error) + func (m *Model) PutRef(ref *Ref) error + func (m *Model) QueueList(page, perPage int64) ([]*QueueItem, error) + func (m *Model) QueueListForRepository(repo *Repository, page, perPage int64) ([]*QueueItem, error) + func (m *Model) QueuePipelineAdd(qis []*QueueItem) ([]*QueueItem, error) + func (m *Model) QueueTotalCount() (int64, error) + func (m *Model) QueueTotalCountForRepository(repo *Repository) (int64, error) + func (m *Model) RemoveCapabilityFromUser(u *User, cap Capability) error + func (m *Model) RemoveSubscriptionForUser(u *User, repo *Repository) error + func (m *Model) RunList(page, perPage int64, repository, sha string) ([]*Run, error) + func (m *Model) RunListForRepository(repo *Repository, ref *Ref, page, perPage int64) ([]*Run, error) + func (m *Model) RunTotalCount() (int64, error) + func (m *Model) RunTotalCountForRepository(repo *Repository) (int64, error) + func (m *Model) RunTotalCountForRepositoryAndSHA(repo *Repository, sha string) (int64, error) + func (m *Model) RunsForSubmission(sub *Submission, page, perPage int64) ([]*Run, error) + func (m *Model) RunsForTicket(repoName string, ticketID int) ([]*Run, error) + func (m *Model) SaveRepositories(repos []*gh.Repository, username string, autoCreated bool) error + func (m *Model) SaveSession(session *Session) error + func (m *Model) SetRunStatus(runID int64, gh github.Client, status, canceled bool, url, addlMessage string) error + func (m *Model) SubmissionCount(repository, sha string) (int64, error) + func (m *Model) SubmissionList(page, perPage int64, repository, sha string) ([]*Submission, error) + func (m *Model) SubmissionListForRepository(repo, sha string, page, perPage int64) ([]*Submission, error) + func (m *Model) TasksForSubmission(sub *Submission, page, perPage int64) ([]*Task, error) + func (m *Model) UpdateTaskStatus(task *Task) error + func (m *Model) ValidateToken(token string) (*User, error) + func (m *Model) WrapError(call *gorm.DB, msg string) error + type OAuth struct + ExpiresOn time.Time + Scopes string + State string + func (o *OAuth) GetScopes() map[string]struct{} + func (o *OAuth) GetScopesList() []string + func (o *OAuth) SetScopes(scopes []string) + func (o *OAuth) ToProto() *data.OAuthState + type QueueItem struct + ID int64 + QueueName string + Run *Run + RunID int64 + Running bool + RunningOn *string + StartedAt *time.Time + func NewQueueItemFromProto(tqi *types.QueueItem) (*QueueItem, error) + func (qi *QueueItem) AfterFind(tx *gorm.DB) error + func (qi *QueueItem) BeforeCreate(tx *gorm.DB) error + func (qi *QueueItem) BeforeSave(tx *gorm.DB) error + func (qi *QueueItem) ToProto() *types.QueueItem + func (qi *QueueItem) Validate() error + type Ref struct + ID int64 + RefName string + Repository *Repository + RepositoryID int64 + SHA string + func NewRefFromProto(r *types.Ref) (*Ref, error) + func (r *Ref) AfterFind(tx *gorm.DB) error + func (r *Ref) BeforeCreate(tx *gorm.DB) error + func (r *Ref) BeforeSave(tx *gorm.DB) error + func (r *Ref) ToProto() *types.Ref + func (r *Ref) Validate() error + type Repository struct + AutoCreated bool + Disabled bool + Github *gh.Repository + GithubJSON []byte + HookSecret string + ID int64 + Name string + Owner *User + OwnerID int64 + Private bool + func NewRepositoryFromProto(r *types.Repository) (*Repository, error) + func (r *Repository) AfterFind(tx *gorm.DB) error + func (r *Repository) BeforeCreate(tx *gorm.DB) error + func (r *Repository) BeforeSave(tx *gorm.DB) error + func (r *Repository) Enabled() bool + func (r *Repository) OwnerRepo() (string, string, error) + func (r *Repository) ToProto() *types.Repository + func (r *Repository) Validate(validOwner bool) error + type RepositoryList []*Repository + func (rl RepositoryList) Len() int + func (rl RepositoryList) Less(i, j int) bool + func (rl RepositoryList) Swap(i, j int) + func (rl RepositoryList) ToProto() *types.RepositoryList + type Run struct + CreatedAt time.Time + FinishedAt *time.Time + ID int64 + Name string + RanOn *string + RunSettings *types.RunSettings + RunSettingsJSON []byte + StartedAt *time.Time + Status *bool + Task *Task + TaskID int64 + func NewRunFromProto(r *gtypes.Run) (*Run, error) + func (r *Run) AfterFind(tx *gorm.DB) error + func (r *Run) BeforeCreate(tx *gorm.DB) error + func (r *Run) BeforeSave(tx *gorm.DB) error + func (r *Run) ToProto() *gtypes.Run + func (r *Run) Validate() error + type Session struct + ExpiresOn time.Time + Key string + Values string + func NewSessionFromProto(s *types.Session) *Session + func (s *Session) ToProto() *types.Session + type Submission struct + BaseRef *Ref + BaseRefID int64 + Canceled bool + CreatedAt time.Time + FinishedAt *time.Time + HeadRef *Ref + HeadRefID int64 + ID int64 + RunsCount int64 + StartedAt *time.Time + Status *bool + TasksCount int64 + TicketID int64 + User *User + UserID int64 + func NewSubmissionFromProto(gt *gtypes.Submission) (*Submission, error) + func (s *Submission) ToProto() *gtypes.Submission + type Task struct + Canceled bool + CreatedAt time.Time + FinishedAt *time.Time + ID int64 + Path string + Runs int64 + StartedAt *time.Time + Status *bool + Submission *Submission + SubmissionID int64 + TaskSettings *types.TaskSettings + TaskSettingsJSON []byte + func NewTaskFromProto(gt *gtypes.Task) (*Task, error) + func (t *Task) AfterFind(tx *gorm.DB) error + func (t *Task) BeforeCreate(tx *gorm.DB) error + func (t *Task) BeforeSave(tx *gorm.DB) error + func (t *Task) ToProto() *gtypes.Task + func (t *Task) Validate() error + type User struct + Errors []UserError + ID int64 + LastScannedRepos *time.Time + LoginToken []byte + Subscribed []*Repository + Token *topTypes.OAuthToken + TokenJSON []byte + Username string + func MakeUsers(users []*types.User) ([]*User, error) + func NewUserFromProto(u *types.User) (*User, error) + func (u *User) AddError(err error) + func (u *User) AfterFind(tx *gorm.DB) error + func (u *User) BeforeCreate(tx *gorm.DB) error + func (u *User) BeforeSave(tx *gorm.DB) error + func (u *User) FetchToken() error + func (u *User) SetToken() error + func (u *User) ToProto() *types.User + func (u *User) Validate() error + func (u *User) ValidateWrite() error + type UserError struct + Error string + ID int64 + UserID int64 + func NewUserErrorFromProto(ue *types.UserError) *UserError + func (ue UserError) ToProto() *types.UserError