package gitstats
import "zgo.at/git-stats"
Index ¶
- Variables
- func CountCommits(ctx context.Context, repoID int32, rng ztime.Range) (int, error)
- func FindOrInsertAuthor(ctx context.Context, c Commit, names, emails map[string]int64) (int64, error)
- func FindOrInsertFile(ctx context.Context, c Commit, files map[string]int64) ([]int64, Ints, Ints, error)
- type Author
- type AuthorStat
- type AuthorStats
- func (s AuthorStats) Domains() []Domain
- func (s *AuthorStats) List(ctx context.Context, repoID int32, order string, rng ztime.Range) error
- type Authors
- type Commit
- type CommitFile
- type CommitStat
- type CommitStats
- type Commits
- func (c *Commits) ByAuthor(ctx context.Context, repoID int32, authorID int64, rng ztime.Range) error
- type Domain
- type Event
- type EventKind
- type Events
- type File
- type FileStat
- type Files
- func (f *Files) List(ctx context.Context, repoID int32) error
- func (f *Files) Map() map[string]int64
- type Hash
- func NewHash(s string) Hash
- func (h Hash) Link(repoURL string) template.HTML
- func (h *Hash) Scan(v any) error
- func (h Hash) Short() string
- func (h Hash) String() string
- func (h Hash) URL(repoURL string) template.URL
- func (h Hash) Value() (driver.Value, error)
- type Ints
- func (l *Ints) Scan(v any) error
- func (l Ints) String() string
- func (l Ints) Sum() int64
- func (l Ints) Value() (driver.Value, error)
- type Repo
- func (r *Repo) ByName(ctx context.Context, name string) error
- func (r *Repo) ByPath(ctx context.Context, path string) error
- func (r *Repo) Find(ctx context.Context, name string) error
- func (r *Repo) Insert(ctx context.Context) error
- func (r Repo) Remote() bool
- func (r *Repo) Update(ctx context.Context) error
- type Repos
- type Strings
Variables ¶
Functions ¶
func CountCommits ¶
func FindOrInsertAuthor ¶
func FindOrInsertAuthor(ctx context.Context, c Commit, names, emails map[string]int64) (int64, error)
Find author by name or email, or insert if it doesn't exist.
TODO: treat as case-insensitive, now we have:
Eric Anholt <anholt@freebsd.org>, <anholt@FreeBSD.org> walter harms, Walter Harms <wharms@bfs.de>
And that's not too useful.
func FindOrInsertFile ¶
func FindOrInsertFile(ctx context.Context, c Commit, files map[string]int64) ([]int64, Ints, Ints, error)
Types ¶
type Author ¶
type Author struct { ID int64 `db:"author_id,id"` RepoID int32 `db:"repo_id"` Names Strings `db:"names"` Emails Strings `db:"emails"` Commits int `db:"-"` Added int `db:"-"` Removed int `db:"-"` First string `db:"-"` Last string `db:"-"` }
func (*Author) ByID ¶
type AuthorStat ¶
type AuthorStat struct { AuthorID int `db:"author_id"` Commits int `db:"commits"` Added int `db:"added"` Removed int `db:"removed"` CommitPerc float32 `db:"commit_perc"` AddedPerc float32 `db:"added_perc"` RemovedPerc float32 `db:"removed_perc"` Names Strings `db:"names"` Emails Strings `db:"emails"` First time.Time `db:"first"` Last time.Time `db:"last"` Domains []string `db:"-"` }
func (*AuthorStat) ByID ¶
type AuthorStats ¶
type AuthorStats []AuthorStat
func (AuthorStats) Domains ¶
func (s AuthorStats) Domains() []Domain
func (*AuthorStats) List ¶
type Authors ¶
type Authors []Author
func (*Authors) List ¶
type Commit ¶
type Commit struct { RepoID int32 `db:"repo_id"` Hash Hash `db:"hash,id"` Date time.Time `db:"date"` AuthorID int `db:"author_id"` Exclude sql.NullBool `db:"exclude"` Files Strings `db:"files"` Added Ints `db:"added"` Removed Ints `db:"removed"` AddedSum int `db:"added_sum"` RemovedSum int `db:"removed_sum"` Subject string `db:"subject"` Email string `db:"-"` Name string `db:"-"` UpdFiles []CommitFile `db:"files"` }
func (*Commit) ShouldExclude ¶
Also: toml 782628a7 (gofmt -s)
type CommitFile ¶
func (*CommitFile) ShouldExclude ¶
func (c *CommitFile) ShouldExclude() bool
type CommitStat ¶
type CommitStat struct { Date time.Time `db:"date" json:"date"` Commits int `db:"commits" json:"commits"` Added int `db:"added" json:"added"` Removed int `db:"removed" json:"removed"` }
type CommitStats ¶
type CommitStats []CommitStat
func (*CommitStats) List ¶
func (s *CommitStats) List(ctx context.Context, repoID int32, rng ztime.Range, authorID int64, groupMonth bool) error
type Commits ¶
type Commits []Commit
func (*Commits) ByAuthor ¶
func (c *Commits) ByAuthor(ctx context.Context, repoID int32, authorID int64, rng ztime.Range) error
type Domain ¶
type Event ¶
type Event struct { EventID int32 `db:"event_id,id" json:"-"` RepoID int32 `db:"repo_id" json:"-"` Name string `db:"name" json:"name"` Date time.Time `db:"date" json:"date"` Kind EventKind `db:"kind" json:"kind"` }
func (*Event) Find ¶
func (*Event) Insert ¶
type EventKind ¶
type EventKind byte
func (EventKind) String ¶
type Events ¶
type Events []Event
func (*Events) List ¶
type File ¶
type File struct { ID int64 `db:"file_id,id"` RepoID int `db:"repo_id"` Path string `db:"path"` Exclude bool `db:"exclude"` }
type FileStat ¶
type FileStat []struct { ID int `db:"file_id"` Path string `db:"path"` NumCommits string `db:"num_commits"` }
func (*FileStat) List ¶
TODO: positional: "/foo/bar%" -depth group stuff by max depth Add authors info
type Files ¶
type Files []File
func (*Files) List ¶
func (*Files) Map ¶
Map returns a path → file_id map.
type Hash ¶
type Hash [20]byte
func NewHash ¶
func (Hash) Link ¶
func (*Hash) Scan ¶
func (Hash) Short ¶
func (Hash) String ¶
func (Hash) URL ¶
func (Hash) Value ¶
type Ints ¶
type Ints []int64
func (*Ints) Scan ¶
func (Ints) String ¶
func (Ints) Sum ¶
func (Ints) Value ¶
type Repo ¶
type Repo struct { ID int32 `db:"repo_id,id"` Path string `db:"path"` Name string `db:"name"` FirstCommit *Hash `db:"first_commit"` LastCommit *Hash `db:"last_commit"` FirstCommitAt *time.Time `db:"first_commit_at"` LastCommitAt *time.Time `db:"last_commit_at"` Commits int `db:"commits,noinsert"` }
func (*Repo) ByName ¶
func (*Repo) ByPath ¶
func (*Repo) Find ¶
func (*Repo) Insert ¶
func (Repo) Remote ¶
func (*Repo) Update ¶
type Repos ¶
type Repos []Repo
func (*Repos) List ¶
type Strings ¶
type Strings []string
func (Strings) Join ¶
func (*Strings) Scan ¶
func (Strings) String ¶
func (Strings) Value ¶
Source Files ¶
author.go commit.go event.go file.go helper.go init.go repo.go
Directories ¶
Path | Synopsis |
---|---|
cmd | |
cmd/git-stats | |
db2 |
- Version
- v0.0.0-20240410145522-3037a55246c2 (latest)
- Published
- Apr 10, 2024
- Platform
- linux/amd64
- Imports
- 21 packages
- Last checked
- 1 month ago –
Tools for package owners.