db

package
v0.0.0-...-09c6cb6 Latest Latest
Warning

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

Go to latest
Published: May 24, 2020 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateBuild

func CreateBuild(db *pgutil.LoggingDB, logger nacelle.Logger, b *BuildWithProject) error

func CreateBuildLog

func CreateBuildLog(db *pgutil.LoggingDB, logger nacelle.Logger, l *BuildLog) error

func CreateProject

func CreateProject(db *pgutil.LoggingDB, logger nacelle.Logger, p *Project) error

func DeleteBuild

func DeleteBuild(db *pgutil.LoggingDB, logger nacelle.Logger, b *Build) error

func DeleteBuildLogsForBuild

func DeleteBuildLogsForBuild(db *pgutil.LoggingDB, logger nacelle.Logger, buildID uuid.UUID) error

func DeleteProject

func DeleteProject(db *pgutil.LoggingDB, logger nacelle.Logger, projectID uuid.UUID) error

func UpdateBuild

func UpdateBuild(db *pgutil.LoggingDB, logger nacelle.Logger, b *Build) error

func UpdateBuildLog

func UpdateBuildLog(db *pgutil.LoggingDB, logger nacelle.Logger, l *BuildLog) error

func UpdateProject

func UpdateProject(db *pgutil.LoggingDB, logger nacelle.Logger, p *Project) error

Types

type Build

type Build struct {
	BuildID              uuid.UUID   `db:"build_id" json:"build_id"`
	ProjectID            uuid.UUID   `db:"project_id" json:"project_id"`
	BuildStatus          string      `db:"build_status" json:"build_status"`
	AgentAddr            *string     `db:"agent_addr" json:"agent_addr"`
	CommitBranch         *string     `db:"commit_branch" json:"commit_branch"`
	CommitHash           *string     `db:"commit_hash" json:"commit_hash"`
	CommitMessage        *string     `db:"commit_message" json:"commit_message"`
	CommitAuthorName     *string     `db:"commit_author_name" json:"commit_author_name"`
	CommitAuthorEmail    *string     `db:"commit_author_email" json:"commit_author_email"`
	CommitAuthoredAt     *time.Time  `db:"commit_authored_at" json:"commit_authored_at"`
	CommitCommitterName  *string     `db:"commit_committer_name" json:"commit_committer_name"`
	CommitCommitterEmail *string     `db:"commit_committer_email" json:"commit_committer_email"`
	CommitCommittedAt    *time.Time  `db:"commit_committed_at" json:"commit_committed_at"`
	ErrorMessage         *string     `db:"error_message" json:"error_message"`
	CreatedAt            time.Time   `db:"created_at" json:"created_at"`
	QueuedAt             time.Time   `db:"queued_at" json:"queued_at"`
	StartedAt            *time.Time  `db:"started_at" json:"started_at"`
	CompletedAt          *time.Time  `db:"completed_at" json:"completed_at"`
	TextSearchVector     interface{} `db:"tsv" json:"-"`
}

func GetBuildsForProject

func GetBuildsForProject(db *pgutil.LoggingDB, projectID uuid.UUID, meta *pgutil.PageMeta, filter string) ([]*Build, *pgutil.PagedResultMeta, error)

type BuildLog

type BuildLog struct {
	BuildLogID uuid.UUID  `db:"build_log_id" json:"build_log_id"`
	BuildID    uuid.UUID  `db:"build_id" json:"build_id"`
	Name       string     `db:"name" json:"name"`
	CreatedAt  time.Time  `db:"created_at" json:"created_at"`
	UploadedAt *time.Time `db:"uploaded_at" json:"uploaded_at"`
	Content    *string    `db:"content" json:"content"` // TODO - careful when this is fetched
}

func GetBuildLog

func GetBuildLog(db *pgutil.LoggingDB, buildID, buildLogID uuid.UUID) (*BuildLog, error)

func GetBuildLogs

func GetBuildLogs(db *pgutil.LoggingDB, buildID uuid.UUID) ([]*BuildLog, error)

type BuildWithLogs

type BuildWithLogs struct {
	*BuildWithProject
	BuildLogs []*BuildLog `json:"build_logs"`
}

type BuildWithProject

type BuildWithProject struct {
	*Build
	Project *Project `db:"project" json:"project"`
}

func GetActiveBuilds

func GetActiveBuilds(db *pgutil.LoggingDB, meta *pgutil.PageMeta, filter string) ([]*BuildWithProject, *pgutil.PagedResultMeta, error)

func GetBuild

func GetBuild(db *pgutil.LoggingDB, buildID uuid.UUID) (*BuildWithProject, error)

func GetBuilds

func GetBuilds(db *pgutil.LoggingDB, meta *pgutil.PageMeta, filter string) ([]*BuildWithProject, *pgutil.PagedResultMeta, error)

func GetQueuedBuilds

func GetQueuedBuilds(db *pgutil.LoggingDB, meta *pgutil.PageMeta, filter string) ([]*BuildWithProject, *pgutil.PagedResultMeta, error)

type Event

type Event struct {
	Table  string                 `json:"table"`
	Action string                 `json:"action"`
	Data   map[string]interface{} `json:"data"`
}

type Monitor

type Monitor interface {
	nacelle.Process
	Subscribe() (string, <-chan Event)
	Unsubscribe(id string)
}

func NewMonitor

func NewMonitor() Monitor

type Project

type Project struct {
	ProjectID            uuid.UUID   `db:"project_id" json:"project_id"`
	Name                 string      `db:"name" json:"name"`
	RepositoryURL        string      `db:"repository_url" json:"repository_url"`
	LastBuildID          *uuid.UUID  `db:"last_build_id" json:"last_build_id"`
	LastBuildStatus      *string     `db:"last_build_status" json:"last_build_status"`
	LastBuildCompletedAt *time.Time  `db:"last_build_completed_at" json:"last_build_completed_at"`
	TextSearchVector     interface{} `db:"tsv" json:"-"`
}

func GetOrCreateProject

func GetOrCreateProject(db *pgutil.LoggingDB, logger nacelle.Logger, repositoryURL string) (*Project, error)

func GetProject

func GetProject(db *pgutil.LoggingDB, projectID uuid.UUID) (*Project, error)

func GetProjects

func GetProjects(db *pgutil.LoggingDB, meta *pgutil.PageMeta, filter string) ([]*Project, *pgutil.PagedResultMeta, error)

Jump to

Keyboard shortcuts

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