Documentation ¶
Index ¶
- Constants
- Variables
- func CleanEntities(db *sql.DB) error
- func Contains[T comparable](list []T, val T) bool
- func GetCNCFEntityAffiliations() (map[string]*CNCFDeveloper, error)
- func GetDB(path string) (*sql.DB, error)
- func GetDataState(db *sql.DB) (map[string]int64, error)
- func GetDeveloperUsernames(db *sql.DB) ([]string, error)
- func GetNoFullnameDeveloperUsernames(db *sql.DB) ([]string, error)
- func GetOrgRepoNames(ctx context.Context, client *http.Client, org string) ([]string, error)
- func ImportEvents(dbPath, token, owner, repo string, months int) (map[string]int, error)
- func Init(dbFilePath string) error
- func SaveDevelopers(db *sql.DB, devs []*Developer) error
- func SaveState(db *sql.DB, query, org, repo string, state *State) error
- func UpdateDeveloper(ctx context.Context, db *sql.DB, client *http.Client, username string, ...) error
- func UpdateDeveloperNames(db *sql.DB, devs map[string]string) error
- func UpdateEvents(dbPath, token string) (map[string]int, error)
- type AffiliationImportResult
- type CNCFAffiliation
- type CNCFDeveloper
- type CountedItem
- func GetDeveloperPercentages(db *sql.DB, entity, org, repo *string, ex []string, months int) ([]*CountedItem, error)
- func GetEntityPercentages(db *sql.DB, entity, org, repo *string, ex []string, months int) ([]*CountedItem, error)
- func QueryEntities(db *sql.DB, val string, limit int) ([]*CountedItem, error)
- type CountedResult
- type Developer
- type DeveloperListItem
- type EntityResult
- type Event
- type EventDetails
- type EventImporter
- type EventSearchCriteria
- type EventTypeSeries
- type ListItem
- type Org
- type OrgRepoItem
- type Query
- type Repo
- type State
- type Substitution
Constants ¶
const ( // EventTypes is a list of event types to import EventTypePR string = "pr" EventTypePRReview string = "pr_review" EventTypeIssue string = "issue" EventTypeIssueComment string = "issue_comment" EventTypeFork string = "fork" EventAgeMonthsDefault = 6 )
const (
DataFileName string = "data.db"
)
Variables ¶
var ( EventTypes = []string{ EventTypePR, EventTypeIssue, EventTypeIssueComment, EventTypePRReview, EventTypeFork, } )
var (
UpdatableProperties = []string{
"entity",
}
)
Functions ¶
func CleanEntities ¶
func Contains ¶ added in v0.3.9
func Contains[T comparable](list []T, val T) bool
Contains checks for val in list
func GetCNCFEntityAffiliations ¶
func GetCNCFEntityAffiliations() (map[string]*CNCFDeveloper, error)
func GetDataState ¶
GetDataState returns the current state of the database.
func GetOrgRepoNames ¶ added in v0.3.2
func ImportEvents ¶
ImportEvents imports events from GitHub for a given org/repo combination.
func UpdateDeveloper ¶
Types ¶
type AffiliationImportResult ¶
type AffiliationImportResult struct { Duration string `json:"duration,omitempty"` DBDevs int `json:"db_devs,omitempty"` CNCFDevs int `json:"cncf_devs,omitempty"` MappedDevs int `json:"mapped_devs,omitempty"` }
func UpdateDevelopersWithCNCFEntityAffiliations ¶
func UpdateDevelopersWithCNCFEntityAffiliations(ctx context.Context, db *sql.DB, client *http.Client) (*AffiliationImportResult, error)
UpdateDevelopersWithCNCFEntityAffiliations updates the developers with the CNCF entity affiliations.
type CNCFAffiliation ¶
type CNCFDeveloper ¶
type CNCFDeveloper struct { Username string `json:"username,omitempty"` Identities []string `json:"identities,omitempty"` Affiliations []*CNCFAffiliation `json:"affiliations,omitempty"` }
func (*CNCFDeveloper) GetBestIdentity ¶
func (c *CNCFDeveloper) GetBestIdentity() string
func (*CNCFDeveloper) GetLatestAffiliation ¶
func (c *CNCFDeveloper) GetLatestAffiliation() string
type CountedItem ¶
func GetDeveloperPercentages ¶
func GetDeveloperPercentages(db *sql.DB, entity, org, repo *string, ex []string, months int) ([]*CountedItem, error)
GetOrgRepoPercentages returns a list of repo percentages for the given organization.
func GetEntityPercentages ¶
func GetEntityPercentages(db *sql.DB, entity, org, repo *string, ex []string, months int) ([]*CountedItem, error)
GetEntityPercentages returns a list of entity percentages for the given repository.
func QueryEntities ¶
type CountedResult ¶
type Developer ¶
type Developer struct { Username string `json:"username,omitempty"` FullName string `json:"full_name,omitempty"` Email string `json:"email,omitempty"` AvatarURL string `json:"avatar,omitempty"` ProfileURL string `json:"url,omitempty"` Entity string `json:"entity,omitempty"` Organizations []*Org `json:"organizations,omitempty"` }
type DeveloperListItem ¶
type DeveloperListItem struct { Username string `json:"username,omitempty"` Entity string `json:"entity,omitempty"` }
func SearchDevelopers ¶
SearchDevelopers returns a list of developers matching the given query.
func SearchGitHubUsers ¶
type EntityResult ¶
type EntityResult struct { Entity string `json:"entity,omitempty"` DeveloperCount int `json:"developer_count,omitempty"` Developers []*DeveloperListItem `json:"developers,omitempty"` }
type Event ¶
type Event struct { Org string `json:"org,omitempty"` Repo string `json:"repo,omitempty"` Username string `json:"username,omitempty"` Type string `json:"type,omitempty"` Date string `json:"date,omitempty"` URL string `json:"url,omitempty"` Mentions string `json:"mentions,omitempty"` Labels string `json:"labels,omitempty"` }
type EventDetails ¶
type EventDetails struct { Event *Event `json:"event,omitempty"` Developer *Developer `json:"developer,omitempty"` }
func SearchEvents ¶
func SearchEvents(db *sql.DB, q *EventSearchCriteria) ([]*EventDetails, error)
type EventImporter ¶
type EventImporter struct {
// contains filtered or unexported fields
}
type EventSearchCriteria ¶
type EventSearchCriteria struct { FromDate *string `json:"from,omitempty"` ToDate *string `json:"to,omitempty"` Type *string `json:"type,omitempty"` Org *string `json:"org,omitempty"` Repo *string `json:"repo,omitempty"` Username *string `json:"user,omitempty"` Entity *string `json:"entity,omitempty"` Mention *string `json:"mention,omitempty"` Label *string `json:"label,omitempty"` Page int `json:"page,omitempty"` PageSize int `json:"page_size,omitempty"` }
func (EventSearchCriteria) String ¶
func (c EventSearchCriteria) String() string
type EventTypeSeries ¶
type EventTypeSeries struct { Dates []string `json:"dates"` PRs []int `json:"pr"` PRReviews []int `json:"pr_review"` Issues []int `json:"issue"` IssueComments []int `json:"issue_comment"` Forks []int `json:"fork"` Avg []float32 `json:"avg"` }
func GetEventTypeSeries ¶
type ListItem ¶
func GetEntityLike ¶
GetEntityLike returns a list of repos that match the given pattern.
func GetOrgLike ¶
GetOrgLike returns a list of orgs and repos that match the given pattern.
type Org ¶
type OrgRepoItem ¶
func GetAllOrgRepos ¶
func GetAllOrgRepos(db *sql.DB) ([]*OrgRepoItem, error)
GetAllOrgRepos returns a list of repo percentages for the given organization.
type Repo ¶
type Substitution ¶ added in v0.3.10
type Substitution struct { Prop string `json:"prop"` Old string `json:"old"` New string `json:"new"` Records int64 `json:"records"` }
func ApplySubstitutions ¶ added in v0.3.10
func ApplySubstitutions(db *sql.DB) ([]*Substitution, error)
func SaveAndApplyDeveloperSub ¶ added in v0.3.10
func SaveAndApplyDeveloperSub(db *sql.DB, prop, old, new string) (*Substitution, error)