Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Commit ¶
type Commit struct {
ID string
ShortID string
Author Author
CreatedAt time.Time
Message string
WebURL string
}
Commit holds the details of a git commit
func (Commit) AuthorSlackString ¶ added in v0.1.0
AuthorSlackString returns a string which can be nicely rendered through Slack
func (Commit) ShortMessage ¶
ShortMessage truncates commit messages down to 80 chars and omits return carriages
type Comparison ¶
Comparison holds the information of a git compare response
func (Comparison) AuthorsSlackString ¶ added in v0.1.0
func (c Comparison) AuthorsSlackString() (out string)
AuthorsSlackString returns a string containing authors who contributed within the diff, in a format which can be nicely rendered in Slack
func (Comparison) CommitCount ¶
func (c Comparison) CommitCount() uint
CommitCount returns the amount of commits
func (Comparison) GetAuthors ¶ added in v0.1.0
func (c Comparison) GetAuthors() (authors Authors)
GetAuthors returns Authors who appeared to have make contribution(s) in the comparison
func (*Comparison) HydrateCommitsAuthorsWithSlackUserID ¶ added in v0.1.0
func (c *Comparison) HydrateCommitsAuthorsWithSlackUserID(mapping map[string]string)
HydrateCommitsAuthorsWithSlackUserID adds the SlackUserID of an author based on its email address
type Provider ¶
type Provider interface {
WebBaseURL() string
Type() ProviderType
Compare(string, Ref, Ref) (*Comparison, error)
ListRepositories() (Repositories, error)
ListRefs(string) (Refs, error)
}
Provider is used to represent any kind of git provider
type ProviderType ¶
type ProviderType uint8
ProviderType represents the type of git provider
const ( // ProviderTypeGitHub for GitHub provider ProviderTypeGitHub ProviderType = iota // ProviderTypeGitLab for GitLab provider ProviderTypeGitLab )
func GetProviderTypeFromString ¶ added in v0.1.0
func GetProviderTypeFromString(p string) (pt ProviderType, err error)
GetProviderTypeFromString returns a ProviderType based onto a given string
func (ProviderType) String ¶
func (pt ProviderType) String() string
String returns the name of the provider (lowercase)
func (ProviderType) StringPretty ¶
func (pt ProviderType) StringPretty() string
StringPretty returns the name of the provider using their capitalization attributes
type Providers ¶
type Providers map[ProviderType]Provider
Providers can store multiple Provider based on their types
func (Providers) ListRepositories ¶
func (ps Providers) ListRepositories() (repos Repositories, err error)
ListRepositories aggregates the repositories for all configured providers
type RankedRef ¶
RankedRef can be used when fuzzy searching Refs, attributing a "rank" for the Ref given the pertinence of its attributes given the search
type RankedRepositories ¶
type RankedRepositories []*RankedRepository
RankedRepositories is a slice of *RankedRepository
type RankedRepository ¶
type RankedRepository struct {
Repository
Rank int
}
RankedRepository can be used when fuzzy searching Repositories, attributing a "rank" for the Repository given the pertinence of its attributes given the search
type Ref ¶
type Ref struct {
Name string
Type RefType
WebURL string
// OriginRef can be used to store the ref onto which a GitLab environment
// is pointing to
OriginRef *Ref
}
Ref holds details of a git reference
type Refs ¶
Refs holds multiple Ref with their unique identifiers (RefKey)
func (Refs) GetByClosestNameMatch ¶
GetByClosestNameMatch returns the Ref which is the most pertinent given its Name
type Repositories ¶
type Repositories map[RepositoryKey]Repository
Repositories holds multiple Repository with their unique identifiers (RepositoryKey)
func (Repositories) GetByClosestNameMatch ¶
func (rs Repositories) GetByClosestNameMatch(name string) (repo Repository)
GetByClosestNameMatch returns the Repository which is the most pertinent given its Name
func (Repositories) GetByKey ¶
func (rs Repositories) GetByKey(k RepositoryKey) (r Repository, ok bool)
GetByKey returns a Repository given its RepositoryKey
func (Repositories) Search ¶
func (rs Repositories) Search(filter string, limit int) (repos RankedRepositories)
Search looks up for repositories by Name in a fuzzy finding fashion, it will return them sorted by pertinence
type Repository ¶
type Repository struct {
ProviderType ProviderType
Name string
Refs Refs
RefsLastUpdate time.Time
RefsCurrentlyUpdating bool
WebURL string
}
Repository holds details of a git repository
func (Repository) IsEmpty ¶ added in v0.1.0
func (r Repository) IsEmpty() bool
IsEmpty assess the variable is empty or not
func (Repository) Key ¶
func (r Repository) Key() RepositoryKey
Key returns a unique identifier based upon the Name and ProviderType of the Repository
type RepositoryKey ¶
type RepositoryKey string
RepositoryKey is a unique identifier for a Repository