internal

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BranchDurationsRow

type BranchDurationsRow struct {
	Branch        string `json:"branch"`
	SumDurationMs int64  `json:"sum_duration_ms"`
}

type Build

type Build struct {
	ID          int64     `json:"id"`
	CommitSha   string    `json:"commit_sha"`
	Branch      string    `json:"branch"`
	Env         string    `json:"env"`
	Status      string    `json:"status"`
	Author      string    `json:"author"`
	Message     string    `json:"message"`
	DurationMs  int64     `json:"duration_ms"`
	StartedAt   time.Time `json:"started_at"`
	FailedTests *int64    `json:"failed_tests"`
}

type BuildTotalsRow

type BuildTotalsRow struct {
	SumDurationMs  int64   `json:"sum_duration_ms"`
	AvgDurationMs  float64 `json:"avg_duration_ms"`
	MaxFailedTests int64   `json:"max_failed_tests"`
}

type CreateBuildParams

type CreateBuildParams struct {
	CommitSha   string    `json:"commit_sha"`
	Branch      string    `json:"branch"`
	Env         string    `json:"env"`
	Status      string    `json:"status"`
	Author      string    `json:"author"`
	Message     string    `json:"message"`
	DurationMs  int64     `json:"duration_ms"`
	StartedAt   time.Time `json:"started_at"`
	FailedTests *int64    `json:"failed_tests"`
}

type CreateBulkBuildParams

type CreateBulkBuildParams struct {
	CommitSha   string    `json:"commit_sha"`
	Branch      string    `json:"branch"`
	Env         string    `json:"env"`
	Status      string    `json:"status"`
	Author      string    `json:"author"`
	Message     string    `json:"message"`
	DurationMs  int64     `json:"duration_ms"`
	StartedAt   time.Time `json:"started_at"`
	FailedTests *int64    `json:"failed_tests"`
}

type DBTX

type DBTX interface {
	ExecContext(context.Context, string, ...interface{}) (sql.Result, error)
	PrepareContext(context.Context, string) (*sql.Stmt, error)
	QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error)
	QueryRowContext(context.Context, string, ...interface{}) *sql.Row
}

type ListBranchStatusHistoryParams

type ListBranchStatusHistoryParams struct {
	Branch string `json:"branch"`
	Status string `json:"status"`
}

type ListBranchStatusesRow

type ListBranchStatusesRow struct {
	Branch string `json:"branch"`
	Status string `json:"status"`
}

type ListBuildsForCleanupParams

type ListBuildsForCleanupParams struct {
	MinStartedAt time.Time `json:"min_started_at"`
	MaxStartedAt time.Time `json:"max_started_at"`
}

type ListEnvBranchDurationsRow

type ListEnvBranchDurationsRow struct {
	Branch        string  `json:"branch"`
	SumDurationMs int64   `json:"sum_duration_ms"`
	AvgDurationMs float64 `json:"avg_duration_ms"`
}

type Queries

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

func New

func New(db DBTX) *Queries

func (*Queries) BranchDurations

func (q *Queries) BranchDurations(ctx context.Context) ([]BranchDurationsRow, error)

GroupBy returns one row per branch, an aggregate query names itself

func (*Queries) BuildTotals

func (q *Queries) BuildTotals(ctx context.Context) (BuildTotalsRow, error)

without a GroupBy the aggregates fold the whole table into one row

func (*Queries) CreateBuild

func (q *Queries) CreateBuild(ctx context.Context, arg CreateBuildParams) (int64, error)

Code generated by entlite. DO NOT EDIT. SQLC compatible query definitions Build CRUD operations re-running the same commit overwrites the row instead of failing on the unique column

func (*Queries) CreateBulkBuild

func (q *Queries) CreateBulkBuild(ctx context.Context, arg CreateBulkBuildParams) (int64, error)

many rows in one call, the wrapper loops the single row insert

func (*Queries) DB

func (q *Queries) DB() DBTX

DB returns the handle this Queries was constructed with.

func (*Queries) DeleteAllBuild

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

func (*Queries) DeleteBuild

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

func (*Queries) GetBuildByCommitSha

func (q *Queries) GetBuildByCommitSha(ctx context.Context, commitSha string) (Build, error)

GetBy names the columns itself, they have to be unique together

func (*Queries) GetBuildById

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

Get() keys on the primary key

func (*Queries) ListAllBuild

func (q *Queries) ListAllBuild(ctx context.Context) ([]Build, error)

no filters, the whole table

func (*Queries) ListBranchStatusHistory

func (q *Queries) ListBranchStatusHistory(ctx context.Context, arg ListBranchStatusHistoryParams) ([]Build, error)

two fields are two = filters joined by AND, and the sort chain order is the order of the columns in ORDER BY

func (*Queries) ListBranchStatuses

func (q *Queries) ListBranchStatuses(ctx context.Context) ([]ListBranchStatusesRow, error)

several columns dedupe on the tuple and return a row struct

func (*Queries) ListBranches

func (q *Queries) ListBranches(ctx context.Context) ([]string, error)

one column returns the values, the method gives []string

func (*Queries) ListBuildByBranch

func (q *Queries) ListBuildByBranch(ctx context.Context, branch string) ([]Build, error)

a string field becomes an = filter, the caller sends the value

func (*Queries) ListBuildsForCleanup

func (q *Queries) ListBuildsForCleanup(ctx context.Context, arg ListBuildsForCleanupParams) ([]Build, error)

query level Contracts() drops the rpc, only the database method is generated

func (*Queries) ListEnvBranchDurations

func (q *Queries) ListEnvBranchDurations(ctx context.Context, env string) ([]ListEnvBranchDurationsRow, error)

the groups take filters, sorting and paging like any other list

func (*Queries) ListEnvBranches

func (q *Queries) ListEnvBranches(ctx context.Context, env string) ([]string, error)

the same, narrowed by a filter first

func (*Queries) ListLatestBuilds

func (q *Queries) ListLatestBuilds(ctx context.Context, branch string) ([]Build, error)

a fixed Limit(10) stays in the sql, so it is not part of the request

func (*Queries) SearchBuilds

func (q *Queries) SearchBuilds(ctx context.Context, arg SearchBuildsParams) ([]SearchBuildsRow, error)

Count() returns how many rows match, counted before Limit cuts the page. Limit() and Offset() take their values from the caller.

func (*Queries) UpdateBuild

func (q *Queries) UpdateBuild(ctx context.Context, arg UpdateBuildParams) (Build, error)

func (*Queries) WithTx

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

type SearchBuildsParams

type SearchBuildsParams struct {
	Env          string    `json:"env"`
	MinStartedAt time.Time `json:"min_started_at"`
	MaxStartedAt time.Time `json:"max_started_at"`
	Message      string    `json:"message"`
	Status       string    `json:"status"`
	Offset       int64     `json:"offset"`
	Limit        int64     `json:"limit"`
}

type SearchBuildsRow

type SearchBuildsRow struct {
	ID          int64     `json:"id"`
	CommitSha   string    `json:"commit_sha"`
	Branch      string    `json:"branch"`
	Env         string    `json:"env"`
	Status      string    `json:"status"`
	Author      string    `json:"author"`
	Message     string    `json:"message"`
	DurationMs  int64     `json:"duration_ms"`
	StartedAt   time.Time `json:"started_at"`
	FailedTests *int64    `json:"failed_tests"`
	TotalSize   int64     `json:"total_size"`
}

type UpdateBuildParams

type UpdateBuildParams struct {
	CommitSha   string    `json:"commit_sha"`
	Branch      string    `json:"branch"`
	Env         string    `json:"env"`
	Status      string    `json:"status"`
	Author      string    `json:"author"`
	Message     string    `json:"message"`
	DurationMs  int64     `json:"duration_ms"`
	StartedAt   time.Time `json:"started_at"`
	FailedTests *int64    `json:"failed_tests"`
	ID          int64     `json:"id"`
}

Jump to

Keyboard shortcuts

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