Documentation
¶
Index ¶
- Constants
- Variables
- func Contains[T comparable](list []T, val T) bool
- type AffiliationImportResult
- type CNCFAffiliation
- type CNCFDeveloper
- type ChangeFailureRateSeries
- type ContainerActivitySeries
- type ContainerStore
- type ContributorFunnelSeries
- type ContributorProfileSeries
- type CountedItem
- type CountedResult
- type DailyActivitySeries
- type DeepReputationResult
- type DeleteResult
- type DeleteStore
- type Developer
- type DeveloperListItem
- type DeveloperStore
- type EntityResult
- type EntityStore
- type Event
- type EventDetails
- type EventSearchCriteria
- type EventStore
- type EventTypeSeries
- type FirstResponseSeries
- type ForksAndActivitySeries
- type ImportSummary
- type InsightsStore
- type InsightsSummary
- type IssueRatioSeries
- type ListItem
- type MetricHistoryStore
- type MomentumSeries
- type Org
- type OrgRepoItem
- type OrgStore
- type PRReviewRatioSeries
- type PRSizeSeries
- type Query
- type QueryStore
- type ReleaseCadenceSeries
- type ReleaseDownloadsByTagSeries
- type ReleaseDownloadsSeries
- type ReleaseStore
- type Repo
- type RepoMeta
- type RepoMetaStore
- type RepoMetricHistory
- type RepoOverview
- type RepoStore
- type ReputationDistribution
- type ReputationResult
- type ReputationStore
- type RetentionSeries
- type ReviewLatencySeries
- type SignalSummary
- type State
- type StateStore
- type Store
- type Substitution
- type SubstitutionStore
- type TokenFunc
- type UserReputation
- type VelocitySeries
Constants ¶
Variables ¶
var ErrDBNotInitialized = errors.New("database not initialized")
ErrDBNotInitialized is returned when the database has not been opened.
var UpdatableProperties = []string{
"entity",
}
UpdatableProperties lists developer fields that can be substituted.
Functions ¶
Types ¶
type AffiliationImportResult ¶
type AffiliationImportResult struct {
Duration string `json:"duration,omitempty" yaml:"duration,omitempty"`
DBDevs int `json:"db_devs,omitempty" yaml:"dbDevs,omitempty"`
CNCFDevs int `json:"cncf_devs,omitempty" yaml:"cncfDevs,omitempty"`
MappedDevs int `json:"mapped_devs,omitempty" yaml:"mappedDevs,omitempty"`
}
type CNCFAffiliation ¶
type CNCFDeveloper ¶
type CNCFDeveloper struct {
Username string `json:"username,omitempty" yaml:"username,omitempty"`
Identities []string `json:"identities,omitempty" yaml:"identities,omitempty"`
Affiliations []*CNCFAffiliation `json:"affiliations,omitempty" yaml:"affiliations,omitempty"`
}
func (*CNCFDeveloper) GetBestIdentity ¶
func (c *CNCFDeveloper) GetBestIdentity() string
func (*CNCFDeveloper) GetLatestAffiliation ¶
func (c *CNCFDeveloper) GetLatestAffiliation() string
type ChangeFailureRateSeries ¶ added in v0.9.0
type ContainerActivitySeries ¶ added in v0.12.0
type ContainerActivitySeries struct {
Months []string `json:"months" yaml:"months"`
Versions []int `json:"versions" yaml:"versions"`
}
ContainerActivitySeries is the chart data for container version publishes per month.
type ContainerStore ¶ added in v0.16.0
type ContainerStore interface {
ImportContainerVersions(ctx context.Context, token, org, repo string) error
ImportAllContainerVersions(ctx context.Context, token string) error
GetContainerActivity(org, repo *string, months int) (*ContainerActivitySeries, error)
}
ContainerStore manages container version imports and queries.
type ContributorFunnelSeries ¶ added in v0.9.0
type ContributorProfileSeries ¶ added in v0.15.0
type CountedItem ¶
type CountedResult ¶
type DailyActivitySeries ¶ added in v0.8.1
type DeepReputationResult ¶ added in v0.7.2
type DeepReputationResult struct {
Scored int `json:"scored" yaml:"scored"`
Skipped int `json:"skipped" yaml:"skipped"`
Errors int `json:"errors" yaml:"errors"`
}
DeepReputationResult is returned by the bulk deep scoring step.
type DeleteResult ¶ added in v0.7.5
type DeleteResult struct {
Org string `json:"org" yaml:"org"`
Repo string `json:"repo" yaml:"repo"`
Events int64 `json:"events" yaml:"events"`
RepoMeta int64 `json:"repo_meta" yaml:"repo_meta"`
Releases int64 `json:"releases" yaml:"releases"`
ReleaseAssets int64 `json:"release_assets" yaml:"release_assets"`
State int64 `json:"state" yaml:"state"`
}
type DeleteStore ¶ added in v0.16.0
type DeleteStore interface {
DeleteRepoData(org, repo string) (*DeleteResult, error)
}
DeleteStore manages data deletion.
type Developer ¶
type Developer struct {
Username string `json:"username,omitempty" yaml:"username,omitempty"`
FullName string `json:"full_name,omitempty" yaml:"fullName,omitempty"`
Email string `json:"email,omitempty" yaml:"email,omitempty"`
AvatarURL string `json:"avatar,omitempty" yaml:"avatar,omitempty"`
ProfileURL string `json:"url,omitempty" yaml:"url,omitempty"`
Entity string `json:"entity,omitempty" yaml:"entity,omitempty"`
Organizations []*Org `json:"organizations,omitempty" yaml:"organizations,omitempty"`
}
type DeveloperListItem ¶
type DeveloperStore ¶ added in v0.16.0
type DeveloperStore interface {
GetDeveloperUsernames() ([]string, error)
GetNoFullnameDeveloperUsernames() ([]string, error)
SaveDevelopers(devs []*Developer) error
MergeDeveloper(ctx context.Context, client *http.Client, username string, cDev *CNCFDeveloper) (*Developer, error)
GetDeveloper(username string) (*Developer, error)
SearchDevelopers(val string, limit int) ([]*DeveloperListItem, error)
UpdateDeveloperNames(devs map[string]string) error
}
DeveloperStore manages developer records.
type EntityResult ¶
type EntityResult struct {
Entity string `json:"entity,omitempty" yaml:"entity,omitempty"`
DeveloperCount int `json:"developer_count,omitempty" yaml:"developerCount,omitempty"`
Developers []*DeveloperListItem `json:"developers,omitempty" yaml:"developers,omitempty"`
}
type EntityStore ¶ added in v0.16.0
type EntityStore interface {
GetEntityLike(query string, limit int) ([]*ListItem, error)
GetEntity(val string) (*EntityResult, error)
QueryEntities(val string, limit int) ([]*CountedItem, error)
CleanEntities() error
}
EntityStore manages entity lookups and queries.
type Event ¶
type Event struct {
Org string `json:"org,omitempty" yaml:"org,omitempty"`
Repo string `json:"repo,omitempty" yaml:"repo,omitempty"`
Username string `json:"username,omitempty" yaml:"username,omitempty"`
Type string `json:"type,omitempty" yaml:"type,omitempty"`
Date string `json:"date,omitempty" yaml:"date,omitempty"`
URL string `json:"url,omitempty" yaml:"url,omitempty"`
Mentions string `json:"mentions,omitempty" yaml:"mentions,omitempty"`
Labels string `json:"labels,omitempty" yaml:"labels,omitempty"`
State *string `json:"state,omitempty" yaml:"state,omitempty"`
Number *int `json:"number,omitempty" yaml:"number,omitempty"`
CreatedAt *string `json:"created_at,omitempty" yaml:"createdAt,omitempty"`
ClosedAt *string `json:"closed_at,omitempty" yaml:"closedAt,omitempty"`
MergedAt *string `json:"merged_at,omitempty" yaml:"mergedAt,omitempty"`
Additions *int `json:"additions,omitempty" yaml:"additions,omitempty"`
Deletions *int `json:"deletions,omitempty" yaml:"deletions,omitempty"`
ChangedFiles *int `json:"changed_files,omitempty" yaml:"changed_files,omitempty"`
Commits *int `json:"commits,omitempty" yaml:"commits,omitempty"`
Title string `json:"title,omitempty" yaml:"title,omitempty"`
}
type EventDetails ¶
type EventSearchCriteria ¶
type EventSearchCriteria struct {
FromDate *string `json:"from,omitempty" yaml:"from,omitempty"`
ToDate *string `json:"to,omitempty" yaml:"to,omitempty"`
Type *string `json:"type,omitempty" yaml:"type,omitempty"`
Org *string `json:"org,omitempty" yaml:"org,omitempty"`
Repo *string `json:"repo,omitempty" yaml:"repo,omitempty"`
Username *string `json:"user,omitempty" yaml:"user,omitempty"`
Entity *string `json:"entity,omitempty" yaml:"entity,omitempty"`
Mention *string `json:"mention,omitempty" yaml:"mention,omitempty"`
Label *string `json:"label,omitempty" yaml:"label,omitempty"`
Page int `json:"page,omitempty" yaml:"page,omitempty"`
PageSize int `json:"page_size,omitempty" yaml:"pageSize,omitempty"`
}
func (EventSearchCriteria) String ¶
func (c EventSearchCriteria) String() string
type EventStore ¶ added in v0.16.0
type EventStore interface {
ImportEvents(ctx context.Context, token, owner, repo string, months int) (map[string]int, *ImportSummary, error)
UpdateEvents(ctx context.Context, token string, concurrency int) (map[string]int, error)
}
EventStore manages event imports.
type EventTypeSeries ¶
type EventTypeSeries struct {
Dates []string `json:"dates" yaml:"dates"`
PRs []int `json:"pr" yaml:"pr"`
PRReviews []int `json:"pr_review" yaml:"prReview"`
Issues []int `json:"issue" yaml:"issue"`
IssueComments []int `json:"issue_comment" yaml:"issueComment"`
Forks []int `json:"fork" yaml:"fork"`
Total []int `json:"total" yaml:"total"`
Trend []float32 `json:"trend" yaml:"trend"`
}
type FirstResponseSeries ¶ added in v0.20.2
type ForksAndActivitySeries ¶ added in v0.6.8
type ImportSummary ¶
type ImportSummary struct {
Repo string `json:"repo" yaml:"repo"`
Since string `json:"since" yaml:"since"`
Events int `json:"events" yaml:"events"`
Developers int `json:"developers" yaml:"developers"`
}
ImportSummary contains per-repo import metadata.
type InsightsStore ¶ added in v0.16.0
type InsightsStore interface {
GetInsightsSummary(org, repo, entity *string, months int) (*InsightsSummary, error)
GetDailyActivity(org, repo, entity *string, months int) (*DailyActivitySeries, error)
GetContributorRetention(org, repo, entity *string, months int) (*RetentionSeries, error)
GetPRReviewRatio(org, repo, entity *string, months int) (*PRReviewRatioSeries, error)
GetChangeFailureRate(org, repo, entity *string, months int) (*ChangeFailureRateSeries, error)
GetReviewLatency(org, repo, entity *string, months int) (*ReviewLatencySeries, error)
GetTimeToMerge(org, repo, entity *string, months int) (*VelocitySeries, error)
GetTimeToClose(org, repo, entity *string, months int) (*VelocitySeries, error)
GetTimeToRestoreBugs(org, repo, entity *string, months int) (*VelocitySeries, error)
GetPRSizeDistribution(org, repo, entity *string, months int) (*PRSizeSeries, error)
GetForksAndActivity(org, repo, entity *string, months int) (*ForksAndActivitySeries, error)
GetContributorFunnel(org, repo, entity *string, months int) (*ContributorFunnelSeries, error)
GetContributorMomentum(org, repo, entity *string, months int) (*MomentumSeries, error)
GetContributorProfile(username string, org, repo, entity *string, months int) (*ContributorProfileSeries, error)
GetIssueOpenCloseRatio(org, repo, entity *string, months int) (*IssueRatioSeries, error)
GetTimeToFirstResponse(org, repo, entity *string, months int) (*FirstResponseSeries, error)
}
InsightsStore provides analytics and insights queries.
type InsightsSummary ¶
type InsightsSummary struct {
BusFactor int `json:"bus_factor" yaml:"busFactor"`
PonyFactor int `json:"pony_factor" yaml:"ponyFactor"`
Orgs int `json:"orgs" yaml:"orgs"`
Repos int `json:"repos" yaml:"repos"`
Events int `json:"events" yaml:"events"`
Contributors int `json:"contributors" yaml:"contributors"`
LastImport string `json:"last_import" yaml:"lastImport"`
}
type IssueRatioSeries ¶ added in v0.20.2
type MetricHistoryStore ¶ added in v0.16.0
type MetricHistoryStore interface {
ImportRepoMetricHistory(ctx context.Context, token, owner, repo string) error
ImportAllRepoMetricHistory(ctx context.Context, token string) error
GetRepoMetricHistory(org, repo *string, months int) ([]*RepoMetricHistory, error)
}
MetricHistoryStore manages repository metric history imports and queries.
type MomentumSeries ¶ added in v0.9.0
type OrgRepoItem ¶
type OrgStore ¶ added in v0.16.0
type OrgStore interface {
GetAllOrgRepos() ([]*OrgRepoItem, error)
GetDeveloperPercentages(entity, org, repo *string, ex []string, months int) ([]*CountedItem, error)
GetEntityPercentages(entity, org, repo *string, ex []string, months int) ([]*CountedItem, error)
SearchDeveloperUsernames(query string, org, repo *string, months, limit int) ([]string, error)
GetOrgLike(query string, limit int) ([]*ListItem, error)
}
OrgStore manages organization-level queries.
type PRReviewRatioSeries ¶
type PRSizeSeries ¶ added in v0.9.0
type QueryStore ¶ added in v0.16.0
type QueryStore interface {
SearchEvents(q *EventSearchCriteria) ([]*EventDetails, error)
GetMinEventDate(org, repo *string) (string, error)
GetEventTypeSeries(org, repo, entity *string, months int) (*EventTypeSeries, error)
}
QueryStore manages event search and aggregation queries.
type ReleaseCadenceSeries ¶
type ReleaseDownloadsByTagSeries ¶ added in v0.7.0
type ReleaseDownloadsSeries ¶ added in v0.7.0
type ReleaseStore ¶ added in v0.16.0
type ReleaseStore interface {
ImportReleases(ctx context.Context, token, owner, repo string) error
ImportAllReleases(ctx context.Context, token string) error
GetReleaseCadence(org, repo, entity *string, months int) (*ReleaseCadenceSeries, error)
GetReleaseDownloads(org, repo *string, months int) (*ReleaseDownloadsSeries, error)
GetReleaseDownloadsByTag(org, repo *string, months int) (*ReleaseDownloadsByTagSeries, error)
}
ReleaseStore manages release imports and queries.
type RepoMeta ¶
type RepoMeta struct {
Org string `json:"org" yaml:"org"`
Repo string `json:"repo" yaml:"repo"`
Stars int `json:"stars" yaml:"stars"`
Forks int `json:"forks" yaml:"forks"`
OpenIssues int `json:"open_issues" yaml:"openIssues"`
Language string `json:"language" yaml:"language"`
License string `json:"license" yaml:"license"`
Archived bool `json:"archived" yaml:"archived"`
HasCoC bool `json:"has_coc" yaml:"hasCoc"`
HasContributing bool `json:"has_contributing" yaml:"hasContributing"`
HasReadme bool `json:"has_readme" yaml:"hasReadme"`
HasIssueTemplate bool `json:"has_issue_template" yaml:"hasIssueTemplate"`
HasPRTemplate bool `json:"has_pr_template" yaml:"hasPrTemplate"`
CommunityHealthPct int `json:"community_health_pct" yaml:"communityHealthPct"`
UpdatedAt string `json:"updated_at" yaml:"updatedAt"`
}
type RepoMetaStore ¶ added in v0.16.0
type RepoMetaStore interface {
ImportRepoMeta(ctx context.Context, token, owner, repo string) error
ImportAllRepoMeta(ctx context.Context, token string) error
GetRepoMetas(org, repo *string) ([]*RepoMeta, error)
GetRepoOverview(org *string, months int) ([]*RepoOverview, error)
}
RepoMetaStore manages repository metadata imports and queries.
type RepoMetricHistory ¶ added in v0.8.0
type RepoOverview ¶ added in v0.19.0
type RepoOverview struct {
Org string `json:"org"`
Repo string `json:"repo"`
Stars int `json:"stars"`
Forks int `json:"forks"`
OpenIssues int `json:"open_issues"`
Events int `json:"events"`
Contributors int `json:"contributors"`
Scored int `json:"scored"`
Language string `json:"language"`
License string `json:"license"`
Archived bool `json:"archived"`
LastImport string `json:"last_import"`
}
type ReputationDistribution ¶
type ReputationDistribution struct {
Labels []string `json:"labels" yaml:"labels"`
Data []float64 `json:"data" yaml:"data"`
Scored int `json:"scored" yaml:"scored"`
Total int `json:"total" yaml:"total"`
}
ReputationDistribution is the dashboard chart data.
type ReputationResult ¶
type ReputationResult struct {
Updated int `json:"updated" yaml:"updated"`
Skipped int `json:"skipped" yaml:"skipped"`
Errors int `json:"errors" yaml:"errors"`
}
ReputationResult is returned by the shallow bulk import.
type ReputationStore ¶ added in v0.16.0
type ReputationStore interface {
ImportReputation(org, repo *string) (*ReputationResult, error)
ImportDeepReputation(ctx context.Context, tokenFn TokenFunc, limit, staleHours int, org, repo *string) (*DeepReputationResult, error)
GetOrComputeDeepReputation(ctx context.Context, token, username string) (*UserReputation, error)
ComputeDeepReputation(ctx context.Context, token, username string) (*UserReputation, error)
GetReputationDistribution(org, repo, entity *string, months int) (*ReputationDistribution, error)
}
ReputationStore manages reputation scoring.
type RetentionSeries ¶
type ReviewLatencySeries ¶ added in v0.9.0
type SignalSummary ¶
type SignalSummary struct {
AgeDays int64 `json:"age_days" yaml:"ageDays"`
Followers int64 `json:"followers" yaml:"followers"`
Following int64 `json:"following" yaml:"following"`
PublicRepos int64 `json:"public_repos" yaml:"publicRepos"`
Suspended bool `json:"suspended" yaml:"suspended"`
OrgMember bool `json:"org_member" yaml:"orgMember"`
Commits int64 `json:"commits" yaml:"commits"`
TotalCommits int64 `json:"total_commits" yaml:"totalCommits"`
TotalContributors int `json:"total_contributors" yaml:"totalContributors"`
LastCommitDays int64 `json:"last_commit_days" yaml:"lastCommitDays"`
AuthorAssociation string `json:"author_association" yaml:"authorAssociation"`
HasBio bool `json:"has_bio" yaml:"hasBio"`
HasCompany bool `json:"has_company" yaml:"hasCompany"`
HasLocation bool `json:"has_location" yaml:"hasLocation"`
HasWebsite bool `json:"has_website" yaml:"hasWebsite"`
PRsMerged int64 `json:"prs_merged" yaml:"prsMerged"`
PRsClosed int64 `json:"prs_closed" yaml:"prsClosed"`
RecentPRRepoCount int64 `json:"recent_pr_repo_count" yaml:"recentPRRepoCount"`
ForkedRepos int64 `json:"forked_repos" yaml:"forkedRepos"`
TrustedOrgMember bool `json:"trusted_org_member" yaml:"trustedOrgMember"`
}
SignalSummary exposes gathered signals to the UI.
type StateStore ¶ added in v0.16.0
type StateStore interface {
GetState(query, org, repo string, min time.Time) (*State, error)
SaveState(query, org, repo string, state *State) error
ClearState(org, repo string) error
GetDataState() (map[string]int64, error)
}
StateStore manages import state tracking.
type Store ¶ added in v0.16.0
type Store interface {
io.Closer
StateStore
DeleteStore
SubstitutionStore
EntityStore
RepoStore
OrgStore
DeveloperStore
QueryStore
EventStore
InsightsStore
ReleaseStore
ContainerStore
RepoMetaStore
MetricHistoryStore
ReputationStore
}
Store is the top-level interface composing all sub-interfaces.
type Substitution ¶
type SubstitutionStore ¶ added in v0.16.0
type SubstitutionStore interface {
SaveAndApplyDeveloperSub(prop, old, new string) (*Substitution, error)
ApplySubstitutions() ([]*Substitution, error)
}
SubstitutionStore manages developer substitutions.
type TokenFunc ¶ added in v0.18.0
type TokenFunc func() string
TokenFunc returns a GitHub API token. Used by methods that make many API calls in a loop so they can rotate tokens from a pool on each iteration.
type UserReputation ¶
type UserReputation struct {
Username string `json:"username" yaml:"username"`
Reputation float64 `json:"reputation" yaml:"reputation"`
Deep bool `json:"deep" yaml:"deep"`
Signals *SignalSummary `json:"signals,omitempty" yaml:"signals,omitempty"`
}
UserReputation is returned by the on-demand deep score endpoint.