cache

package
v0.0.0-...-351974c Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2024 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const ColumnsIssues = "repo, number, title, user, state, milestone, labels, created, closed, daysopen"
View Source
const ColumnsPR = "repo, number, title, user, state, milestone, merged, merger, created, closed, daysopen, dayswaiting, daystofirst"

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache struct {
	Path string
	DB   *sql.DB
}

func Open

func Open(path string) (*Cache, error)

func (Cache) CalculateRepoPRStatsForDateRange

func (cache Cache) CalculateRepoPRStatsForDateRange(from, to time.Time, repos []string, authors []string) (*PRsStats, error)

func (Cache) ComputeAndUpdatePRStats

func (cache Cache) ComputeAndUpdatePRStats(repo string, number int) (open, waiting, tofirst *float64, err error)

func (Cache) GetAllRepoIssues

func (cache Cache) GetAllRepoIssues(repos []string) (*[]Issue, error)

func (Cache) GetAllRepoPRs

func (cache Cache) GetAllRepoPRs(repos []string) (*[]PR, error)

func (Cache) GetEventsFor

func (cache Cache) GetEventsFor(repo string, number int) ([]Event, error)

func (Cache) GetIssue

func (cache Cache) GetIssue(repo string, number int) (*Issue, error)

func (Cache) GetPR

func (cache Cache) GetPR(repo string, number int) (*PR, error)

func (Cache) GetRepoIssuesCreatedForDateRange

func (cache Cache) GetRepoIssuesCreatedForDateRange(repos []string, from, to time.Time) (*[]Issue, error)

func (Cache) GetRepoIssuesOpenForDateRange

func (cache Cache) GetRepoIssuesOpenForDateRange(repos []string, from, to time.Time) (*[]Issue, error)

func (Cache) GetRepoPRsCreatedForDateRange

func (cache Cache) GetRepoPRsCreatedForDateRange(repos []string, from, to time.Time) (*[]PR, error)

func (Cache) GetRepoPRsOpenForDateRange

func (cache Cache) GetRepoPRsOpenForDateRange(repos []string, from, to time.Time) (*[]PR, error)

func (Cache) GetRepoPRsWithState

func (cache Cache) GetRepoPRsWithState(repos []string, state string) (*[]PR, error)

func (Cache) QueryForIssues

func (cache Cache) QueryForIssues(qfmt string, a ...any) (*[]Issue, error)

func (Cache) QueryForPRs

func (cache Cache) QueryForPRs(qfmt string, a ...any) (*[]PR, error)

func (Cache) UpsertEvent

func (cache Cache) UpsertEvent(repo string, pr int, event *github.Timeline) error

func (Cache) UpsertIssueStats

func (cache Cache) UpsertIssueStats(repo string, number int, daysOpen, daysWaiting, daysToFirst float64) error

func (Cache) UpsertPRStats

func (cache Cache) UpsertPRStats(repo string, number int, daysOpen, daysWaiting, daysToFirst float64) error

func (Cache) UpsertRepoIssueFromGH

func (cache Cache) UpsertRepoIssueFromGH(repo string, issue *github.Issue) error

func (Cache) UpsertRepoPRFromGH

func (cache Cache) UpsertRepoPRFromGH(repo string, pr *github.PullRequest) error

type Event

type Event struct {
	Repo  string
	PR    int
	Date  time.Time
	Event string
	User  string

	State     string
	Label     string
	Milestone string
	Body      string

	URL string
}

type Issue

type Issue struct {
	Repo      string
	Number    int
	Title     string
	User      string
	State     string // todo should we make this boolean "open" or 2 boolean so we have open/closed/merged ?
	Milestone string
	Labels    string
	Created   time.Time
	Closed    time.Time

	// calculated
	DaysOpen sql.NullFloat64
}

type PR

type PR struct {
	Repo      string
	Number    int
	Title     string
	User      string
	State     string // todo should we make this boolean "open" or 2 boolean so we have open/closed/merged ?
	Milestone string
	Merged    bool
	Merger    string
	Created   time.Time
	Closed    time.Time

	// calculated
	DaysOpen    sql.NullFloat64
	DaysWaiting sql.NullFloat64
	DaysToFirst sql.NullFloat64
}

type PRsStats

type PRsStats struct {
	Total  int
	Open   int
	Merged int
	Closed int

	DaysOpenAverage    sql.NullFloat64
	DaysWaitingAverage sql.NullFloat64
	DaysToFirstAverage sql.NullFloat64

	DaysToFirstOver int
}

Jump to

Keyboard shortcuts

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