tasks

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2022 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const BatchSize = 100

Variables

This section is empty.

Functions

func CollectCommit

func CollectCommit(
	owner string,
	repo string,
	repoId int,
	commit *models.GithubCommit,
	apiClient *GithubApiClient,
) error

for addtions and deletions

func CollectCommits

func CollectCommits(owner string, repo string, repoId int, scheduler *utils.WorkerScheduler, apiClient *GithubApiClient) error

func CollectCommitsStat added in v0.7.0

func CollectCommitsStat(
	owner string,
	repo string,
	repoId int,
	scheduler *utils.WorkerScheduler,
	apiClient *GithubApiClient,
) error

func CollectIssueComments added in v0.3.0

func CollectIssueComments(owner string, repo string, scheduler *utils.WorkerScheduler, apiClient *GithubApiClient) error

func CollectIssueEvents added in v0.3.0

func CollectIssueEvents(owner string, repo string, scheduler *utils.WorkerScheduler, apiClient *GithubApiClient) error

func CollectIssues

func CollectIssues(owner string, repo string, repoId int, scheduler *utils.WorkerScheduler, apiClient *GithubApiClient) error

func CollectPullRequestComments

func CollectPullRequestComments(owner string, repo string, scheduler *utils.WorkerScheduler, apiClient *GithubApiClient) error

func CollectPullRequestCommits

func CollectPullRequestCommits(owner string, repo string, scheduler *utils.WorkerScheduler, apiClient *GithubApiClient) error

func CollectPullRequestReviews

func CollectPullRequestReviews(owner string, repo string, scheduler *utils.WorkerScheduler, apiClient *GithubApiClient) error

func CollectPullRequests added in v0.7.0

func CollectPullRequests(
	owner string,
	repo string,
	repoId int,
	scheduler *utils.WorkerScheduler,
	apiClient *GithubApiClient,
) error

func CollectRepository

func CollectRepository(owner string, repo string, apiClient *GithubApiClient) (int, error)

func ConvertCommits added in v0.6.0

func ConvertCommits(githubRepoId int, ctx context.Context) error

func ConvertIssueLabels added in v0.7.0

func ConvertIssueLabels(ctx context.Context) error

func ConvertIssues added in v0.6.0

func ConvertIssues(repoId int, ctx context.Context) error

func ConvertNotes added in v0.6.0

func ConvertNotes(ctx context.Context) error

func ConvertPullRequestLabels added in v0.8.0

func ConvertPullRequestLabels() error

func ConvertPullRequests added in v0.6.0

func ConvertPullRequests(ctx context.Context) error

func ConvertRepos added in v0.6.0

func ConvertRepos(ctx context.Context) error

func ConvertUsers added in v0.6.0

func ConvertUsers(ctx context.Context) error

func EnrichGithubIssues added in v0.7.0

func EnrichGithubIssues(ctx context.Context) (err error)

func EnrichGithubPullRequests added in v0.7.0

func EnrichGithubPullRequests(repoId int, ctx context.Context) (err error)

func PrCommitConvertor added in v0.7.0

func PrCommitConvertor(ctx context.Context) (err error)

func ProcessCollection added in v0.7.0

func ProcessCollection(owner string, repo string, pr *models.GithubPullRequest, scheduler *utils.WorkerScheduler, apiClient *GithubApiClient) error

Types

type ApiCommitsResponse

type ApiCommitsResponse []CommitsResponse

type ApiIssueCommentResponse added in v0.3.0

type ApiIssueCommentResponse []IssueComment

type ApiIssueEventResponse added in v0.3.0

type ApiIssueEventResponse []IssueEvent

type ApiIssuesResponse

type ApiIssuesResponse []IssuesResponse

type ApiPullRequestCommentResponse

type ApiPullRequestCommentResponse []PullRequestComment

type ApiPullRequestCommitResponse

type ApiPullRequestCommitResponse []PrCommitsResponse

type ApiPullRequestResponse added in v0.7.0

type ApiPullRequestResponse []GithubApiPullRequest

type ApiPullRequestReviewResponse

type ApiPullRequestReviewResponse []PullRequestReview

type ApiRepositoryResponse

type ApiRepositoryResponse GithubApiRepo

type ApiSingleCommitResponse

type ApiSingleCommitResponse struct {
	Stats struct {
		Additions int
		Deletions int
	}
}

type Commit

type Commit struct {
	Author struct {
		Name  string
		Email string
		Date  core.Iso8601Time
	}
	Committer struct {
		Name  string
		Email string
		Date  core.Iso8601Time
	}
	Message string
}

type CommitsResponse

type CommitsResponse struct {
	Sha       string `json:"sha"`
	Commit    Commit
	Url       string
	Author    *models.GithubUser
	Committer *models.GithubUser
}

type GithubApiClient

type GithubApiClient struct {
	core.ApiClient
	// contains filtered or unexported fields
}

func CreateApiClient

func CreateApiClient(endpoint string, tokens []string, ctx context.Context) *GithubApiClient

func (*GithubApiClient) FetchWithPaginationAnts

func (githubApiClient *GithubApiClient) FetchWithPaginationAnts(path string, queryParams *url.Values, pageSize int, conc int, scheduler *utils.WorkerScheduler, handler GithubPaginationHandler) error

run all requests in an Ants worker pool conc - number of concurent requests you want to run

func (*GithubApiClient) RunConcurrently added in v0.4.0

func (githubApiClient *GithubApiClient) RunConcurrently(path string, queryParams *url.Values, pageSize int, conc int, scheduler *utils.WorkerScheduler, handler GithubPaginationHandler) error

This method exists in the case where we do not know how many pages of data we have to fetch This loops through the data in chunks of `conc` and if there is any request in there with no data returned, we assume we are at the end of the data required to fetch This is needed since we do not want to make a request to get the paging details first since the rate limit for github is so low

type GithubApiPullRequest added in v0.7.0

type GithubApiPullRequest struct {
	GithubId int `json:"id"`
	Number   int
	State    string
	Title    string
	Body     string
	Labels   []struct {
		Name string `json:"name"`
	} `json:"labels"`
	Assignee *struct {
		Login string
		Id    int
	}
	ClosedAt        *core.Iso8601Time `json:"closed_at"`
	MergedAt        *core.Iso8601Time `json:"merged_at"`
	GithubCreatedAt core.Iso8601Time  `json:"created_at"`
	GithubUpdatedAt *core.Iso8601Time `json:"updated_at"`
	MergeCommitSha  string            `json:"merge_commit_sha"`
}

type GithubApiRepo added in v0.6.0

type GithubApiRepo struct {
	Name        string `json:"name"`
	GithubId    int    `json:"id"`
	HTMLUrl     string `json:"html_url"`
	Language    string `json:"language"`
	Description string `json:"description"`
	Owner       models.GithubUser
	Parent      *GithubApiRepo    `json:"parent"`
	CreatedAt   core.Iso8601Time  `json:"created_at"`
	UpdatedAt   *core.Iso8601Time `json:"updated_at"`
}

type GithubPaginationHandler

type GithubPaginationHandler func(res *http.Response) error

type IssueComment added in v0.3.0

type IssueComment struct {
	GithubId int `json:"id"`
	Body     string
	User     struct {
		Login string
	}
	GithubCreatedAt core.Iso8601Time `json:"created_at"`
}

type IssueEvent added in v0.3.0

type IssueEvent struct {
	GithubId int `json:"id"`
	Event    string
	Actor    struct {
		Login string
	}
	GithubCreatedAt core.Iso8601Time `json:"created_at"`
}

type IssuesResponse

type IssuesResponse struct {
	GithubId    int `json:"id"`
	Number      int
	State       string
	Title       string
	Body        string
	PullRequest struct {
		Url     string `json:"url"`
		HtmlUrl string `json:"html_url"`
	} `json:"pull_request"`
	Labels []struct {
		Name string `json:"name"`
	} `json:"labels"`

	Assignee *struct {
		Login string
		Id    int
	}
	ClosedAt        *core.Iso8601Time `json:"closed_at"`
	GithubCreatedAt core.Iso8601Time  `json:"created_at"`
	GithubUpdatedAt core.Iso8601Time  `json:"updated_at"`
}

type PrCommitsResponse

type PrCommitsResponse struct {
	Sha    string `json:"sha"`
	Commit PullRequestCommit
	Url    string
}

type PullRequestComment added in v0.3.0

type PullRequestComment struct {
	GithubId int `json:"id"`
	Body     string
	User     struct {
		Login string
	}
	GithubCreatedAt core.Iso8601Time `json:"created_at"`
}

type PullRequestCommit added in v0.7.0

type PullRequestCommit struct {
	Author struct {
		Name  string
		Email string
		Date  core.Iso8601Time
	}
	Committer struct {
		Name  string
		Email string
		Date  core.Iso8601Time
	}
	Message string
}

type PullRequestReview

type PullRequestReview struct {
	GithubId int `json:"id"`
	User     struct {
		Id    int
		Login string
	}
	Body        string
	State       string
	SubmittedAt core.Iso8601Time `json:"submitted_at"`
}

Jump to

Keyboard shortcuts

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