db

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DBTX

type DBTX interface {
	Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error)
	Query(context.Context, string, ...interface{}) (pgx.Rows, error)
	QueryRow(context.Context, string, ...interface{}) pgx.Row
}

type DeleteRemovedReposParams

type DeleteRemovedReposParams struct {
	Column1 uuid.UUID
	Column2 []string
}

type DequeueSyncJobRow

type DequeueSyncJobRow struct {
	ID           int64
	CreatedAt    time.Time
	Status       string
	RepoSyncID   uuid.UUID
	RepoID       uuid.UUID
	SyncType     string
	Settings     pgtype.JSONB
	ID_2         uuid.UUID
	Repo         string
	Ref          sql.NullString
	IsGithub     sql.NullBool
	RepoSettings pgtype.JSONB
}

type GitBranch

type GitBranch struct {
	RepoID        uuid.UUID
	FullName      string
	Hash          sql.NullString
	Name          sql.NullString
	Remote        sql.NullString
	Target        sql.NullString
	Type          sql.NullString
	TagCommitHash sql.NullString
}

type GitCommit

type GitCommit struct {
	RepoID         uuid.UUID
	Hash           string
	Message        string
	AuthorName     string
	AuthorEmail    string
	AuthorWhen     time.Time
	CommitterName  string
	CommitterEmail string
	CommitterWhen  time.Time
	Parents        int32
}

Git repository commits

type GitCommitStat

type GitCommitStat struct {
	RepoID     uuid.UUID
	CommitHash string
	FilePath   string
	Additions  int32
	Deletions  int32
}

Commit stats

type GitFile

type GitFile struct {
	RepoID     uuid.UUID
	Path       string
	Executable bool
	Contents   sql.NullString
}

Git repository files

type GitRef

type GitRef struct {
	RepoID        uuid.UUID
	FullName      string
	Hash          sql.NullString
	Name          sql.NullString
	Remote        sql.NullString
	Target        sql.NullString
	Type          sql.NullString
	TagCommitHash sql.NullString
}

Refs for a Git repo

type GitTag

type GitTag struct {
	RepoID        uuid.UUID
	FullName      string
	Hash          sql.NullString
	Name          sql.NullString
	Remote        sql.NullString
	Target        sql.NullString
	Type          sql.NullString
	TagCommitHash sql.NullString
}

type GithubIssue

type GithubIssue struct {
	RepoID              uuid.UUID
	AuthorLogin         sql.NullString
	Body                sql.NullString
	Closed              sql.NullBool
	ClosedAt            sql.NullTime
	CommentCount        sql.NullInt32
	CreatedAt           sql.NullTime
	CreatedViaEmail     sql.NullBool
	DatabaseID          int32
	EditorLogin         sql.NullString
	IncludesCreatedEdit sql.NullBool
	LabelCount          sql.NullInt32
	LastEditedAt        sql.NullTime
	Locked              sql.NullBool
	MilestoneCount      sql.NullInt32
	Number              int32
	ParticipantCount    sql.NullInt32
	PublishedAt         sql.NullTime
	ReactionCount       sql.NullInt32
	State               sql.NullString
	Title               sql.NullString
	UpdatedAt           sql.NullTime
	Url                 sql.NullString
}

GitHub issues

type GithubPullRequest

type GithubPullRequest struct {
	RepoID              uuid.UUID
	Additions           sql.NullInt32
	AuthorLogin         sql.NullString
	AuthorAssociation   sql.NullString
	AuthorAvatarUrl     sql.NullString
	AuthorName          sql.NullString
	BaseRefOid          sql.NullString
	BaseRefName         sql.NullString
	BaseRepositoryName  sql.NullString
	Body                sql.NullString
	ChangedFiles        sql.NullInt32
	Closed              sql.NullBool
	ClosedAt            sql.NullTime
	CommentCount        sql.NullInt32
	CommitCount         sql.NullInt32
	CreatedAt           sql.NullTime
	CreatedViaEmail     sql.NullBool
	DatabaseID          int32
	Deletions           sql.NullInt32
	EditorLogin         sql.NullString
	HeadRefName         sql.NullString
	HeadRefOid          sql.NullString
	HeadRepositoryName  sql.NullString
	IsDraft             sql.NullBool
	LabelCount          sql.NullInt32
	LastEditedAt        sql.NullTime
	Locked              sql.NullBool
	MaintainerCanModify sql.NullBool
	MantainerCanModify  sql.NullBool
	Mergeable           sql.NullString
	Merged              sql.NullBool
	MergedAt            sql.NullTime
	MergedBy            sql.NullString
	Number              sql.NullInt32
	ParticipantCount    sql.NullInt32
	PublishedAt         sql.NullTime
	ReviewDecision      sql.NullString
	State               sql.NullString
	Title               sql.NullString
	UpdatedAt           sql.NullTime
	Url                 sql.NullString
}

GitHub pull requests

type GithubPullRequestCommit

type GithubPullRequestCommit struct {
	RepoID         uuid.UUID
	PrNumber       int32
	Hash           sql.NullString
	Message        sql.NullString
	AuthorName     sql.NullString
	AuthorEmail    sql.NullString
	AuthorWhen     sql.NullTime
	CommitterName  sql.NullString
	CommitterEmail sql.NullString
	CommitterWhen  sql.NullTime
	Additions      sql.NullInt32
	Deletions      sql.NullInt32
	ChangedFiles   sql.NullInt32
	Url            sql.NullString
}

GitHub pull request commits

type GithubPullRequestReview

type GithubPullRequestReview struct {
	RepoID                    uuid.UUID
	PrNumber                  int32
	ID                        string
	AuthorLogin               sql.NullString
	AuthorUrl                 sql.NullString
	AuthorAssociation         sql.NullString
	AuthorCanPushToRepository sql.NullBool
	Body                      sql.NullString
	CommentCount              sql.NullInt32
	CreatedAt                 sql.NullTime
	CreatedViaEmail           sql.NullBool
	EditorLogin               sql.NullString
	LastEditedAt              sql.NullTime
	PublishedAt               sql.NullTime
	State                     sql.NullString
	SubmittedAt               sql.NullTime
	UpdatedAt                 sql.NullTime
}

GitHub pull request reviews

type GithubRepoInfo

type GithubRepoInfo struct {
	RepoID                   uuid.UUID
	Owner                    string
	Name                     string
	CreatedAt                sql.NullTime
	DefaultBranchName        sql.NullString
	Description              sql.NullString
	DiskUsage                sql.NullInt32
	ForkCount                sql.NullInt32
	HomepageUrl              sql.NullString
	IsArchived               sql.NullBool
	IsDisabled               sql.NullBool
	IsMirror                 sql.NullBool
	IsPrivate                sql.NullBool
	TotalIssuesCount         sql.NullInt32
	LatestReleaseAuthor      sql.NullString
	LatestReleaseCreatedAt   sql.NullTime
	LatestReleaseName        sql.NullString
	LatestReleasePublishedAt sql.NullTime
	LicenseKey               sql.NullString
	LicenseName              sql.NullString
	LicenseNickname          sql.NullString
	OpenGraphImageUrl        sql.NullString
	PrimaryLanguage          sql.NullString
	PushedAt                 sql.NullTime
	ReleasesCount            sql.NullInt32
	StargazersCount          sql.NullInt32
	UpdatedAt                sql.NullTime
	WatchersCount            sql.NullInt32
}

GitHub metadata about a repo

type GithubStargazer

type GithubStargazer struct {
	RepoID    uuid.UUID
	Login     string
	Email     sql.NullString
	Name      sql.NullString
	Bio       sql.NullString
	Company   sql.NullString
	AvatarUrl sql.NullString
	CreatedAt sql.NullTime
	UpdatedAt sql.NullTime
	Twitter   sql.NullString
	Website   sql.NullString
	Location  sql.NullString
	StarredAt sql.NullTime
}

GitHub stargazers for a repo

type InsertGitHubRepoInfoParams

type InsertGitHubRepoInfoParams struct {
	RepoID                   uuid.UUID
	Owner                    string
	Name                     string
	CreatedAt                sql.NullTime
	DefaultBranchName        sql.NullString
	Description              sql.NullString
	DiskUsage                sql.NullInt32
	ForkCount                sql.NullInt32
	HomepageUrl              sql.NullString
	IsArchived               sql.NullBool
	IsDisabled               sql.NullBool
	IsMirror                 sql.NullBool
	IsPrivate                sql.NullBool
	TotalIssuesCount         sql.NullInt32
	LatestReleaseAuthor      sql.NullString
	LatestReleaseCreatedAt   sql.NullTime
	LatestReleaseName        sql.NullString
	LatestReleasePublishedAt sql.NullTime
	LicenseKey               sql.NullString
	LicenseName              sql.NullString
	LicenseNickname          sql.NullString
	OpenGraphImageUrl        sql.NullString
	PrimaryLanguage          sql.NullString
	PushedAt                 sql.NullTime
	ReleasesCount            sql.NullInt32
	StargazersCount          sql.NullInt32
	UpdatedAt                sql.NullTime
	WatchersCount            sql.NullInt32
}

type InsertSyncJobLogParams

type InsertSyncJobLogParams struct {
	LogType         string
	Message         string
	RepoSyncQueueID int64
}

type ListRepoImportsDueForImportRow

type ListRepoImportsDueForImportRow struct {
	ID        uuid.UUID
	CreatedAt time.Time
	UpdatedAt time.Time
	Type      string
	Settings  pgtype.JSONB
}

type MergestatLatestRepoSync

type MergestatLatestRepoSync struct {
	ID         int64
	CreatedAt  time.Time
	RepoSyncID uuid.UUID
	Status     string
	StartedAt  sql.NullTime
	DoneAt     sql.NullTime
}

type MergestatRepoImport

type MergestatRepoImport struct {
	ID                  uuid.UUID
	CreatedAt           time.Time
	UpdatedAt           time.Time
	Type                string
	Settings            pgtype.JSONB
	LastImport          sql.NullTime
	ImportInterval      sql.NullString
	LastImportStartedAt sql.NullTime
}

Table for "dynamic" repo imports - regularly loading from a GitHub org for example

type MergestatRepoImportType

type MergestatRepoImportType struct {
	Type        string
	Description string
}

Types of repo imports

type MergestatRepoSync

type MergestatRepoSync struct {
	RepoID   uuid.UUID
	SyncType string
	Settings pgtype.JSONB
	ID       uuid.UUID
}

type MergestatRepoSyncLog

type MergestatRepoSyncLog struct {
	ID              int64
	CreatedAt       time.Time
	LogType         string
	Message         string
	RepoSyncQueueID int64
}

type MergestatRepoSyncLogType

type MergestatRepoSyncLogType struct {
	Type        string
	Description sql.NullString
}

type MergestatRepoSyncQueue

type MergestatRepoSyncQueue struct {
	ID            int64
	CreatedAt     time.Time
	RepoSyncID    uuid.UUID
	Status        string
	StartedAt     sql.NullTime
	DoneAt        sql.NullTime
	LastKeepAlive sql.NullTime
}

type MergestatRepoSyncQueueStatusType

type MergestatRepoSyncQueueStatusType struct {
	Type        string
	Description sql.NullString
}

type MergestatRepoSyncType

type MergestatRepoSyncType struct {
	Type        string
	Description sql.NullString
}

type Queries

type Queries struct {
	// contains filtered or unexported fields
}

func New

func New(db DBTX) *Queries

func (*Queries) DeleteGitHubRepoInfo

func (q *Queries) DeleteGitHubRepoInfo(ctx context.Context, repoID uuid.UUID) error

func (*Queries) DeleteRemovedRepos

func (q *Queries) DeleteRemovedRepos(ctx context.Context, arg DeleteRemovedReposParams) error

func (*Queries) DequeueSyncJob

func (q *Queries) DequeueSyncJob(ctx context.Context) (DequeueSyncJobRow, error)

func (*Queries) EnqueueAllCompletedSyncs

func (q *Queries) EnqueueAllCompletedSyncs(ctx context.Context) error

func (*Queries) EnqueueAllSyncs

func (q *Queries) EnqueueAllSyncs(ctx context.Context) error

func (*Queries) GetRepoImportByID

func (q *Queries) GetRepoImportByID(ctx context.Context, id uuid.UUID) (MergestatRepoImport, error)

func (*Queries) InsertGitHubRepoInfo

func (q *Queries) InsertGitHubRepoInfo(ctx context.Context, arg InsertGitHubRepoInfoParams) error

func (*Queries) InsertSyncJobLog

func (q *Queries) InsertSyncJobLog(ctx context.Context, arg InsertSyncJobLogParams) error

func (*Queries) ListRepoImportsDueForImport

func (q *Queries) ListRepoImportsDueForImport(ctx context.Context) ([]ListRepoImportsDueForImportRow, error)

func (*Queries) MarkRepoImportAsUpdated

func (q *Queries) MarkRepoImportAsUpdated(ctx context.Context, id uuid.UUID) error

func (*Queries) MarkSyncsAsTimedOut

func (q *Queries) MarkSyncsAsTimedOut(ctx context.Context) ([]int64, error)

func (*Queries) SetLatestKeepAliveForJob

func (q *Queries) SetLatestKeepAliveForJob(ctx context.Context, id int64) error

func (*Queries) SetSyncJobStatus

func (q *Queries) SetSyncJobStatus(ctx context.Context, arg SetSyncJobStatusParams) error

func (*Queries) UpsertRepo

func (q *Queries) UpsertRepo(ctx context.Context, arg UpsertRepoParams) error

func (*Queries) WithTx

func (q *Queries) WithTx(tx pgx.Tx) *Queries

type Repo

type Repo struct {
	ID           uuid.UUID
	Repo         string
	Ref          sql.NullString
	IsGithub     sql.NullBool
	CreatedAt    time.Time
	Settings     pgtype.JSONB
	Tags         pgtype.JSONB
	RepoImportID uuid.NullUUID
}

Git repositories to track

type SetSyncJobStatusParams

type SetSyncJobStatusParams struct {
	Status string
	ID     int64
}

type UpsertRepoParams

type UpsertRepoParams struct {
	Repo         string
	IsGithub     sql.NullBool
	RepoImportID uuid.NullUUID
	Tags         pgtype.JSONB
}

Jump to

Keyboard shortcuts

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