Documentation ¶
Index ¶
- Variables
- func PathExists(path string) bool
- type BitBucketMatcher
- func (m BitBucketMatcher) MatchByCommit(ctx context.Context, email, repo, commit string) (user string, err error)
- func (m BitBucketMatcher) MatchByEmail(ctx context.Context, email string) (user string, err error)
- func (m BitBucketMatcher) OnIdle() error
- func (m BitBucketMatcher) SupportsMatchingByCommit() bool
- type CachedMatcher
- func (m CachedMatcher) DumpCache() error
- func (m *CachedMatcher) LoadCache() error
- func (m *CachedMatcher) MatchByCommit(ctx context.Context, email, repo, commit string) (user string, err error)
- func (m *CachedMatcher) MatchByEmail(ctx context.Context, email string) (user string, err error)
- func (m CachedMatcher) OnIdle() error
- func (m *CachedMatcher) SupportsMatchingByCommit() bool
- type CachedUser
- type GitHubMatcher
- type GitLabMatcher
- type Matcher
- type MatcherConstructor
Constants ¶
This section is empty.
Variables ¶
var ErrNoMatches = errors.New("no matches found")
ErrNoMatches is returned when no matches were found.
var Matchers = map[string]MatcherConstructor{ "github": NewGitHubMatcher, "gitlab": NewGitLabMatcher, "bitbucket": NewBitBucketMatcher, }
Matchers is the registered external matcher constructors mapped to shorthands.
Functions ¶
func PathExists ¶
PathExists reports whether a file or directory exists.
Types ¶
type BitBucketMatcher ¶
type BitBucketMatcher struct {
// contains filtered or unexported fields
}
BitBucketMatcher matches emails and BitBucket users.
func (BitBucketMatcher) MatchByCommit ¶
func (m BitBucketMatcher) MatchByCommit( ctx context.Context, email, repo, commit string) (user string, err error)
MatchByCommit queries the identity of a given email address in a particular commit context.
func (BitBucketMatcher) MatchByEmail ¶
MatchByEmail returns the latest BitBucket user with the given email.
func (BitBucketMatcher) SupportsMatchingByCommit ¶
func (m BitBucketMatcher) SupportsMatchingByCommit() bool
SupportsMatchingByCommit indicates whether this Matcher allows querying identities by commit metadata.
type CachedMatcher ¶
type CachedMatcher struct {
// contains filtered or unexported fields
}
CachedMatcher is a wrapper around Matcher with the cache for queried emails.
func NewCachedMatcher ¶
func NewCachedMatcher(matcher Matcher, cachePath string) (*CachedMatcher, error)
NewCachedMatcher creates a new matcher with a cache for a given matcher interface.
func (CachedMatcher) DumpCache ¶
func (m CachedMatcher) DumpCache() error
DumpCache saves the current CachedMatcher cache on disk. It is a proxy for safeUserCache.DumpOnDisk() function.
func (*CachedMatcher) LoadCache ¶
func (m *CachedMatcher) LoadCache() error
LoadCache reads the CachedMatcher cache from disk. It is a proxy for safeUserCache.LoadFromDisk() function.
func (*CachedMatcher) MatchByCommit ¶
func (m *CachedMatcher) MatchByCommit( ctx context.Context, email, repo, commit string) (user string, err error)
MatchByCommit looks in the cache first, and if there is a cache miss, forwards to the underlying Matcher.
func (*CachedMatcher) MatchByEmail ¶
MatchByEmail looks in the cache first, and if there is a cache miss, forwards to the underlying Matcher.
func (CachedMatcher) OnIdle ¶
func (m CachedMatcher) OnIdle() error
OnIdle saves the current CachedMatcher cache on disk.
func (*CachedMatcher) SupportsMatchingByCommit ¶
func (m *CachedMatcher) SupportsMatchingByCommit() bool
SupportsMatchingByCommit acts the same as the underlying Matcher.
type CachedUser ¶
type CachedUser struct { User string Matched bool // false if there is no match from the external API }
CachedUser represents personal name and username of a person
type GitHubMatcher ¶
type GitHubMatcher struct {
// contains filtered or unexported fields
}
GitHubMatcher matches emails and GitHub users.
func (GitHubMatcher) MatchByCommit ¶
func (m GitHubMatcher) MatchByCommit( ctx context.Context, email, repo, commit string) (user string, err error)
MatchByCommit queries the identity of a given email address in a particular commit context.
func (GitHubMatcher) MatchByEmail ¶
MatchByEmail returns the latest GitHub user with the given email.
func (GitHubMatcher) SupportsMatchingByCommit ¶
func (m GitHubMatcher) SupportsMatchingByCommit() bool
SupportsMatchingByCommit indicates whether this Matcher allows querying identities by commit metadata.
type GitLabMatcher ¶
type GitLabMatcher struct {
// contains filtered or unexported fields
}
GitLabMatcher matches emails and GitLab users.
func (GitLabMatcher) MatchByCommit ¶
func (m GitLabMatcher) MatchByCommit( ctx context.Context, email, repo, commit string) (user string, err error)
MatchByCommit queries the identity of a given email address in a particular commit context.
func (GitLabMatcher) MatchByEmail ¶
MatchByEmail returns the latest GitLab user with the given email.
func (GitLabMatcher) SupportsMatchingByCommit ¶
func (m GitLabMatcher) SupportsMatchingByCommit() bool
SupportsMatchingByCommit indicates whether this Matcher allows querying identities by commit metadata.
type Matcher ¶
type Matcher interface { // MatchByEmail queries the identity of a given email address. MatchByEmail(ctx context.Context, email string) (user string, err error) // SupportsMatchingByCommit indicates whether this Matcher allows querying identities by commit metadata. SupportsMatchingByCommit() bool // MatchByCommit queries the identity of a given email address in a particular commit context. MatchByCommit(ctx context.Context, email, repo, commit string) (user string, err error) // OnIdle signals the underlying implementation that the current series of queries is over. OnIdle() error }
Matcher defines the external matching service API, either by email or by commit.
func NewBitBucketMatcher ¶
NewBitBucketMatcher creates a new matcher given a BitBucket personal access token. https://id.atlassian.com/manage/api-tokens
func NewGitHubMatcher ¶
NewGitHubMatcher creates a new matcher given a GitHub token. https://github.com/settings/tokens
func NewGitLabMatcher ¶
NewGitLabMatcher creates a new matcher given a GitLab OAuth token. https://gitlab.com/profile/personal_access_tokens
type MatcherConstructor ¶
MatcherConstructor is the Matcher constructor function type.