Documentation ¶
Overview ¶
hubbub provides an advanced in-memory search for GitHub using state machines
Index ¶
- Constants
- type CommentLike
- type Config
- type Conversation
- type Engine
- func (h *Engine) FindSimilar(co *Conversation) []*RelatedConversation
- func (h *Engine) IssueSummary(i *github.Issue, cs []*github.IssueComment, authorIsMember bool) *Conversation
- func (h *Engine) PRSummary(pr *github.PullRequest, cs []*github.PullRequestComment) *Conversation
- func (h *Engine) SearchAny(ctx context.Context, org string, project string, fs []Filter, ...) ([]*Conversation, time.Time, error)
- func (h *Engine) SearchIssues(ctx context.Context, org string, project string, fs []Filter, ...) ([]*Conversation, time.Time, error)
- func (h *Engine) SearchPullRequests(ctx context.Context, org string, project string, fs []Filter, ...) ([]*Conversation, time.Time, error)
- type Filter
- func (f *Filter) LabelNegate() bool
- func (f *Filter) LabelRegex() *regexp.Regexp
- func (f *Filter) LoadLabelRegex() error
- func (f *Filter) LoadTagRegex() error
- func (f *Filter) LoadTitleRegex() error
- func (f *Filter) TagNegate() bool
- func (f *Filter) TagRegex() *regexp.Regexp
- func (f *Filter) TitleNegate() bool
- func (f *Filter) TitleRegex() *regexp.Regexp
- type GitHubItem
- type RelatedConversation
- type Tag
Constants ¶
const Issue = "issue"
Issue is a type representing an issue
const PullRequest = "pull_request"
PullRequest is a type representing a PR
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CommentLike ¶
type Config ¶
type Config struct { Client *github.Client // Client is a GitHub client Cache persist.Cacher // Cacher is a cache interface Repos []string // Repos is the repositories to search // Cache expiration times MemberRefresh time.Duration // MinSimilarity is how close two items need to be to each other to be called similar MinSimilarity float64 // DebugNumber is used when you want to debug why a single item is being handled in a certain wait DebugNumber int }
Config is how to configure a new hubbub engine
type Conversation ¶
type Conversation struct { ID int `json:"id"` Organization string `json:"organization"` Project string `json:"project"` Hidden bool `json:"hidden"` URL string `json:"url"` Title string `json:"title"` Author *github.User `json:"author"` Type string `json:"type"` State string `json:"state"` Created time.Time `json:"created"` // Latest comment or event Updated time.Time `json:"updated"` SelfInflicted bool `json:"self_inflicted"` Mergeable bool `json:"mergeable"` LatestAuthorResponse time.Time `json:"latest_author_response"` LatestMemberResponse time.Time `json:"latest_member_response"` AccumulatedHoldTime time.Duration `json:"accumulated_hold_time"` CurrentHoldTime time.Duration `json:"current_hold_time"` Assignees []*github.User `json:"assignees"` Labels []*github.Label `json:"labels"` ReactionsTotal int `json:"reactions_total"` Reactions map[string]int `json:"reactions"` ReactionsPerMonth float64 `json:"reactions_per_month"` Commenters []*github.User `json:"commenters"` LastCommentBody string `json:"last_comment_body"` LastCommentAuthor *github.User `json:"last_comment_author"` CommentsTotal int `json:"comments_total"` CommentersTotal int `json:"commenters_total"` CommentersPerMonth float64 `json:"commenters_per_month"` ClosedCommentsTotal int `json:"closed_comments_total"` ClosedCommentersTotal int `json:"closed_commenters_total"` ClosedAt time.Time `json:"closed_at"` ClosedBy *github.User `json:"closed_by"` Tags []Tag `json:"tags"` // Similar issues to this one Similar []*RelatedConversation `json:"similar"` Milestone string `json:"milestone"` }
Conversation represents a discussion within a GitHub item (issue or PR)
type Engine ¶
type Engine struct { // Must be settable from config MinSimilarity float64 // contains filtered or unexported fields }
Engine is the search engine interface for hubbub
func (*Engine) FindSimilar ¶
func (h *Engine) FindSimilar(co *Conversation) []*RelatedConversation
func (*Engine) IssueSummary ¶
func (h *Engine) IssueSummary(i *github.Issue, cs []*github.IssueComment, authorIsMember bool) *Conversation
func (*Engine) PRSummary ¶
func (h *Engine) PRSummary(pr *github.PullRequest, cs []*github.PullRequestComment) *Conversation
func (*Engine) SearchAny ¶
func (h *Engine) SearchAny(ctx context.Context, org string, project string, fs []Filter, newerThan time.Time) ([]*Conversation, time.Time, error)
Search for GitHub issues or PR's
type Filter ¶
type Filter struct { RawLabel string `yaml:"label,omitempty"` RawTag string `yaml:"tag,omitempty"` RawTitle string `yaml:"title,omitempty"` Milestone string `yaml:"milestone,omitempty"` Created string `yaml:"created,omitempty"` Updated string `yaml:"updated,omitempty"` Responded string `yaml:"responded,omitempty"` Reactions string `yaml:"reactions,omitempty"` ReactionsPerMonth string `yaml:"reactions-per-month,omitempty"` Comments string `yaml:"comments,omitempty"` Commenters string `yaml:"commenters,omitempty"` CommentersPerMonth string `yaml:"commenters-per-month,omitempty"` ClosedComments string `yaml:"comments-while-closed,omitempty"` ClosedCommenters string `yaml:"commenters-while-closed,omitempty"` State string `yaml:"state,omitempty"` // contains filtered or unexported fields }
Filter lets you do less.
func (*Filter) LabelNegate ¶
func (*Filter) LabelRegex ¶
func (*Filter) LoadLabelRegex ¶
LoadLabelRegex loads a new label reegx
func (*Filter) LoadTagRegex ¶
LoadTagRegex loads a new tag regex
func (*Filter) LoadTitleRegex ¶
LoadTitleRegex loads a new title regex
func (*Filter) TitleNegate ¶
func (*Filter) TitleRegex ¶
type GitHubItem ¶
type GitHubItem interface { GetAssignee() *github.User GetBody() string GetComments() int GetHTMLURL() string GetCreatedAt() time.Time GetID() int64 GetMilestone() *github.Milestone GetNumber() int GetClosedAt() time.Time GetState() string GetTitle() string GetURL() string GetUpdatedAt() time.Time GetUser() *github.User String() string }
GitHubItem is an interface that matches both GitHub Issues and PullRequests
type RelatedConversation ¶
type RelatedConversation struct { Organization string `json:"org"` Project string `json:"project"` ID int `json:"int"` URL string `json:"url"` Title string `json:"title"` Author *github.User `json:"author"` Type string `json:"type"` Created time.Time `json:"created"` }
A subset of Conversation for related items (requires less memory than a Conversation)