code

package
v0.0.0-...-fea1596 Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2023 License: MIT Imports: 8 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CommitsForAllTime

func CommitsForAllTime(ctx context.Context, db *gorm.DB, user string) (map[string]int64, error)

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

func GithubClient(ctx context.Context, token string) *github.Client

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.

func UserRepos

func UserRepos(ctx context.Context, client *github.Client, user string) ([]*github.Repository, error)

UserRepos gets all of the repos for a user.

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

func (c *Commit) CheckAndSave(ctx context.Context, client *github.Client, db *gorm.DB) error

CheckAndSave upserts a commit. It updates date and user if they are missing.

func (*Commit) String

func (c *Commit) String() string

String returns a string representation of a Commit.

Jump to

Keyboard shortcuts

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