Documentation ¶
Index ¶
- func CommitsForAllTime(ctx context.Context, db *gorm.DB, user string) (map[string]int64, error)
- func CommitsForYear(ctx context.Context, db *gorm.DB, user string, year int) (map[string]int64, error)
- func GithubClient(ctx context.Context, token string) *github.Client
- func RateLimited(err error, log *zap.SugaredLogger) bool
- func UserRepos(ctx context.Context, client *github.Client, user string) ([]*github.Repository, error)
- type Commit
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CommitsForAllTime ¶
CommitsForAllTime gets all commits ever, grouped by day.
func CommitsForYear ¶
func CommitsForYear(ctx context.Context, db *gorm.DB, user string, year int) (map[string]int64, error)
CommitsForYear gets all commits, grouped by week, for a year.
func GithubClient ¶
GithubClient creates a new GithubClient.
func RateLimited ¶
func RateLimited(err error, log *zap.SugaredLogger) bool
RateLimited logs a warning if our error is a rate limit error.
Types ¶
type Commit ¶
type Commit struct { gorm.Model Repo string `gorm:"index:idx_commit,unique" json:"repo"` User string `json:"user"` SHA string `gorm:"index:idx_commit,unique" json:"sha"` CreatedOn time.Time `json:"created_on"` }
Commit is our model.
func (*Commit) CheckAndSave ¶
CheckAndSave upserts a commit. It updates date and user if they are missing.
Click to show internal directories.
Click to hide internal directories.