core

package
v0.0.0-...-c988a1e Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateClient

func CreateClient(token *string, url *string) *gitlab.Client

func FetchCommits

func FetchCommits(user *User, opts *FetchCommitsOptions) []*gitlab.Commit

func FetchProjectsMap

func FetchProjectsMap(user *User) map[int]*Project

Types

type Bucket

type Bucket struct {
	Project   *Project   `json:"project"`
	Namespace *Namespace `json:"namespace"`

	Stats Stats `json:"stats"`
	// contains filtered or unexported fields
}

func CommitsToBuckets

func CommitsToBuckets(commits []*gitlab.Commit, projectsMap map[int]*Project, mode int) (res []*Bucket)

mode 0 - no bucketing (single master bucket) mode 1 - per project mode 2 - per namespace

type FetchCommitsOptions

type FetchCommitsOptions struct {
	From         *time.Time
	To           *time.Time
	WithStats    bool
	MessageRegex *regexp.Regexp
}

type Namespace

type Namespace struct {
	ID       int    `json:"id"`
	Name     string `json:"name"`
	Path     string `json:"path"`
	Kind     string `json:"kind"`
	FullPath string `json:"full_path"`
}

type Occurences

type Occurences struct {
	Count      int
	Occurences map[string]int
}

type Project

type Project struct {
	ID                int        `json:"id"`
	Description       string     `json:"description"`
	SSHURLToRepo      string     `json:"ssh_url_to_repo"`
	WebURL            string     `json:"web_url"`
	Name              string     `json:"name"`
	Path              string     `json:"path"`
	PathWithNamespace string     `json:"path_with_namespace"`
	CreatedAt         *time.Time `json:"created_at"`
	LastActivityAt    *time.Time `json:"last_activity_at"`
	Namespace         *Namespace `json:"namespace"`
}

func FetchProjects

func FetchProjects(user *User) (res []*Project)

type ProjectWithCommits

type ProjectWithCommits struct {
	Project *gitlab.Project  `json:"project"`
	Commits []*gitlab.Commit `json:"commits"`
}

type Stats

type Stats struct {
	Count       int
	Types       map[string]int
	Issues      *Occurences
	Gitmoji     *Occurences
	IssuePrefix *Occurences
}

func CommitsToStats

func CommitsToStats(commits []*gitlab.Commit) (stats Stats)

type User

type User struct {
	GitLabURL   string
	ApiKey      string
	Client      *gitlab.Client
	ProjectsMap map[int]*Project
}

Jump to

Keyboard shortcuts

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