extractor

package
v0.0.0-...-df7d886 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2021 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const GithubDbName = "github"

Variables

This section is empty.

Functions

func GzipCompress

func GzipCompress(data []byte) ([]byte, error)

func GzipExtract

func GzipExtract(data []byte) ([]byte, error)

Types

type ApiComment

type ApiComment struct {
	URL               string    `bson:"url" json:"url"`
	ID                int       `bson:"id" json:"id"`
	NodeID            string    `bson:"node_id" json:"node_id"`
	CreatedAt         time.Time `bson:"created_at" json:"created_at"`
	UpdatedAt         time.Time `bson:"updated_at" json:"updated_at"`
	User              User      `bson:"user" json:"user"`
	AuthorAssociation string    `bson:"author_association" json:"author_association"`
	Body              string    `bson:"body" json:"body"`
}

type ApiIssue

type ApiIssue struct {
	URL         string          `bson:"url" json:"url"`
	HtmlURL     string          `bson:"html_url" json:"html_url"`
	ID          int             `bson:"id" json:"id"`
	NodeID      string          `bson:"node_id" json:"node_id"`
	Number      int             `bson:"number" json:"number"`
	Title       string          `bson:"title" json:"title"`
	User        User            `bson:"user" json:"user"`
	State       string          `bson:"state" json:"state"`
	Comments    int             `bson:"comments" json:"comments"`
	CreatedAt   time.Time       `bson:"created_at" json:"created_at"`
	UpdatedAt   time.Time       `bson:"updated_at" json:"updated_at"`
	ClosedAt    *time.Time      `bson:"closed_at" json:"closed_at"`
	PullRequest *ApiPullRequest `bson:"pull_request" json:"pull_request"`
}

type ApiPullRequest

type ApiPullRequest struct {
	URL               string     `bson:"url" json:"url"`
	NodeID            string     `bson:"node_id" json:"node_id"`
	State             string     `bson:"state" json:"state"`
	Locked            bool       `bson:"locked" json:"locked"`
	Title             string     `bson:"title" json:"title"`
	User              User       `bson:"user" json:"user"`
	Body              string     `bson:"body" json:"body"`
	CreatedAt         time.Time  `bson:"created_at" json:"created_at"`
	UpdatedAt         *time.Time `bson:"updated_at" json:"updated_at"`
	ClosedAt          *time.Time `bson:"closed_at" json:"closed_at"`
	MergedAt          *time.Time `bson:"merged_at" json:"merged_at"`
	Merged            bool       `bson:"merged" json:"merged"`
	MergedBy          *User      `bson:"merged_by" json:"merged_by"`
	MergeCommitSha    string     `bson:"merge_commit_sha" json:"merge_commit_sha"`
	AuthorAssociation string     `bson:"author_association" json:"author_association"`
	Comments          int        `bson:"comments" json:"comments"`
	Commits           int        `bson:"commits" json:"commits"`
	Additions         int        `bson:"additions" json:"additions"`
	Deletions         int        `bson:"deletions" json:"deletions"`
	FilesChanged      int        `bson:"files_changed" json:"files_changed"`
	Number            int        `bson:"number" json:"number"`
}

type ApiPullRequestReviewComment

type ApiPullRequestReviewComment struct {
	ReviewId          int       `bson:"pull_request_review_id" json:"review_id"`
	CommentId         int       `bson:"id" json:"comment_id"`
	Body              string    `bson:"body" json:"body"`
	CreatedAt         time.Time `bson:"created_at" json:"created_at"`
	UpdatedAt         time.Time `bson:"updated_at" json:"updated_at"`
	AuthorAssociation string    `bson:"author_association" json:"author_association"`
	User              User      `bson:"user" json:"user"`
}

type Event

type Event struct {
	ID        string     `bson:"id" json:"id"`
	Type      string     `bson:"type" json:"type"`
	Actor     EventActor `bson:"actor" json:"actor"`
	Repo      RepoInfo   `bson:"repo" json:"repo"`
	Public    bool       `bson:"public" json:"public"`
	CreatedAt time.Time  `bson:"created_at" json:"created_at"`
	OrgInfo   *OrgInfo   `bson:"org" json:"org_info"`
}

type EventActor

type EventActor struct {
	Login        string `bson:"login" json:"login"`
	DisplayLogin string `bson:"display_login" json:"display_login"`
	URL          string `bson:"url" json:"url"`
}

type Extractor

type Extractor struct {
	Config config.Config
	// contains filtered or unexported fields
}

func (*Extractor) LoadFromStdin

func (e *Extractor) LoadFromStdin() error

func (*Extractor) RunFull

func (e *Extractor) RunFull() error

func (*Extractor) RunIssueComments

func (e *Extractor) RunIssueComments() error

func (*Extractor) RunPullRequests

func (e *Extractor) RunPullRequests() error

func (*Extractor) RunReviewComments

func (e *Extractor) RunReviewComments() error

type OrgInfo

type OrgInfo struct {
	ID    string `bson:"id" json:"id"`
	Login string `bson:"login" json:"login"`
	URL   string `bson:"url" json:"url"`
}

type PRCommentEvent

type PRCommentEvent struct {
	ID        string                `bson:"id" json:"id"`
	Type      string                `bson:"type" json:"type"`
	Actor     EventActor            `bson:"actor" json:"actor"`
	Repo      RepoInfo              `bson:"repo" json:"repo"`
	Public    bool                  `bson:"public" json:"public"`
	CreatedAt time.Time             `bson:"created_at" json:"created_at"`
	OrgInfo   *OrgInfo              `bson:"org" json:"org_info"`
	Payload   PRCommentEventPayload `bson:"payload" json:"payload"`
}

func (PRCommentEvent) GetEventTimestamp

func (p PRCommentEvent) GetEventTimestamp() time.Time

func (PRCommentEvent) GetPullRequestNumber

func (p PRCommentEvent) GetPullRequestNumber() int

func (PRCommentEvent) GetPullRequestURL

func (p PRCommentEvent) GetPullRequestURL() string

func (PRCommentEvent) GetRepoName

func (p PRCommentEvent) GetRepoName() string

type PRCommentEventPayload

type PRCommentEventPayload struct {
	Action  string     `bson:"action" json:"action"`
	Comment ApiComment `bson:"comment" json:"comment"`
	Issue   ApiIssue   `bson:"issue" json:"issue"`
}

type PREvent

type PREvent interface {
	GetRepoName() string
	GetPullRequestNumber() int
	GetPullRequestURL() string
	GetEventTimestamp() time.Time
}

type PRReviewCommentEvent

type PRReviewCommentEvent struct {
	ID        string                      `bson:"id" json:"id"`
	Type      string                      `bson:"type" json:"type"`
	Actor     EventActor                  `bson:"actor" json:"actor"`
	Repo      RepoInfo                    `bson:"repo" json:"repo"`
	Public    bool                        `bson:"public" json:"public"`
	CreatedAt time.Time                   `bson:"created_at" json:"created_at"`
	OrgInfo   *OrgInfo                    `bson:"org" json:"org_info"`
	Payload   PRReviewCommentEventPayload `bson:"payload" json:"payload"`
}

func (PRReviewCommentEvent) GetEventTimestamp

func (p PRReviewCommentEvent) GetEventTimestamp() time.Time

func (PRReviewCommentEvent) GetPullRequestNumber

func (p PRReviewCommentEvent) GetPullRequestNumber() int

func (PRReviewCommentEvent) GetPullRequestURL

func (p PRReviewCommentEvent) GetPullRequestURL() string

func (PRReviewCommentEvent) GetRepoName

func (p PRReviewCommentEvent) GetRepoName() string

type PRReviewCommentEventPayload

type PRReviewCommentEventPayload struct {
	Action      string                      `bson:"action" json:"action"`
	PullRequest ApiPullRequest              `bson:"pull_request" json:"pull_request"`
	Comment     ApiPullRequestReviewComment `bson:"comment" json:"comment"`
}

type PullRequest

type PullRequest struct {
	gorm.Model

	EventDbId string `gorm:"unique_index"`

	PullRequestId string `sql:"index"`

	RepoName string `sql:"index"`
	RepoUrl  string
	PRUrl    string
	PRNumber int `sql:"index"`

	State         string `sql:"index"`
	PRAuthorLogin string `sql:"index"`
	PRAuthorType  string `sql:"index"`

	PullRequestCreatedAt time.Time `sql:"index"`
	PullRequestUpdatedAt *time.Time
	PullRequestClosedAt  *time.Time
	PullRequestMergedAt  *time.Time `sql:"index"`

	EventInitiatorLogin       string `sql:"index"`
	EventInitiatorDisplayName string `sql:"index"`

	Comments     int
	Commits      int
	Additions    int
	Deletions    int
	FilesChanged int

	EventTimestamp time.Time `sql:"index"`
	EventAction    string    `sql:"index"`

	RawPayload []byte
}

type PullRequestComment

type PullRequestComment struct {
	gorm.Model

	EventDbId     string `gorm:"unique_index"`
	PullRequestId string `sql:"index"`
	RepoName      string `sql:"index"`
	RepoUrl       string
	PRUrl         string
	PRNumber      int `sql:"index"`

	CommentCreatedAt  time.Time
	CommentUpdatedAt  time.Time
	CommentAuthorName string `sql:"index"`
	CommentAuthorType string `sql:"index"`

	Body string

	EventTimestamp time.Time `sql:"index"`
	EventAction    string    `sql:"index"`

	RawPayload []byte
}

type PullRequestEvent

type PullRequestEvent struct {
	ID        string                  `bson:"id" json:"id"`
	Type      string                  `bson:"type" json:"type"`
	Actor     EventActor              `bson:"actor" json:"actor"`
	Repo      RepoInfo                `bson:"repo" json:"repo"`
	Public    bool                    `bson:"public" json:"public"`
	CreatedAt time.Time               `bson:"created_at" json:"created_at"`
	OrgInfo   *OrgInfo                `bson:"org" json:"org_info"`
	Payload   PullRequestEventPayload `bson:"payload" json:"payload"`
}

func (PullRequestEvent) GetEventTimestamp

func (p PullRequestEvent) GetEventTimestamp() time.Time

func (PullRequestEvent) GetPullRequestNumber

func (p PullRequestEvent) GetPullRequestNumber() int

func (PullRequestEvent) GetPullRequestURL

func (p PullRequestEvent) GetPullRequestURL() string

func (PullRequestEvent) GetRepoName

func (p PullRequestEvent) GetRepoName() string

type PullRequestEventPayload

type PullRequestEventPayload struct {
	Action      string         `bson:"action" json:"action"`
	Number      int            `bson:"number" json:"number"`
	PullRequest ApiPullRequest `bson:"pull_request" json:"pull_request"`
}

type PullRequestReviewComment

type PullRequestReviewComment struct {
	gorm.Model

	EventDbId     string `gorm:"unique_index"`
	PullRequestId string `sql:"index"`
	RepoName      string `sql:"index"`
	RepoUrl       string
	PRUrl         string
	PRNumber      int `sql:"index"`

	ReviewId int `sql:"index"`

	CommentCreatedAt  time.Time
	CommentUpdatedAt  time.Time
	CommentAuthorName string `sql:"index"`
	CommentAuthorType string `sql:"index"`

	Body           string
	EventTimestamp time.Time `sql:"index"`
	EventAction    string    `sql:"index"`

	RawPayload []byte
}

type RepoInfo

type RepoInfo struct {
	Name string `bson:"name" json:"name"`
	Url  string `bson:"url" json:"url"`
}

type User

type User struct {
	Login     string `bson:"login" json:"login"`
	Id        int    `bson:"id" json:"id"`
	NodeId    string `bson:"node_id" json:"node_id"`
	HTMLUrl   string `bson:"html_url" json:"html_url"`
	Type      string `bson:"type" json:"type"`
	SiteAdmin bool   `bson:"site_admin" json:"site_admin"`
}

Jump to

Keyboard shortcuts

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