tasks

package
v0.12.0-rc5 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2022 License: Apache-2.0 Imports: 21 Imported by: 1

Documentation

Index

Constants

View Source
const RAW_COMMENTS_TABLE = "gitee_issue_comments"
View Source
const RAW_COMMIT_STATS_TABLE = "gitee_api_commit_stats"
View Source
const RAW_COMMIT_TABLE = "gitee_api_commit"
View Source
const RAW_ISSUE_TABLE = "gitee_api_issues"
View Source
const RAW_PULL_REQUEST_COMMIT_TABLE = "gitee_api_pull_request_commits"
View Source
const RAW_PULL_REQUEST_REVIEW_TABLE = "gitee_api_pull_request_reviews"

gitee

View Source
const RAW_PULL_REQUEST_TABLE = "gitee_api_pull_requests"
View Source
const RAW_REPOSITORIES_TABLE = "gitee_api_repos"

Variables

View Source
var CollectApiCommitStatsMeta = core.SubTaskMeta{
	Name:             "collectApiCommitStats",
	EntryPoint:       CollectApiCommitStats,
	EnabledByDefault: false,
	Description:      "Collect commitStats data from Gitee api",
	DomainTypes:      []string{core.DOMAIN_TYPE_CODE},
}
View Source
var CollectApiIssueCommentsMeta = core.SubTaskMeta{
	Name:             "collectApiIssueComments",
	EntryPoint:       CollectApiIssueComments,
	EnabledByDefault: true,
	Description:      "Collect comments data from Gitee api",
	DomainTypes:      []string{core.DOMAIN_TYPE_TICKET},
}
View Source
var CollectApiIssuesMeta = core.SubTaskMeta{
	Name:             "collectApiIssues",
	EntryPoint:       CollectApiIssues,
	EnabledByDefault: true,
	Description:      "Collect issues data from Gitee api",
	DomainTypes:      []string{core.DOMAIN_TYPE_TICKET},
}
View Source
var CollectApiPullRequestCommitsMeta = core.SubTaskMeta{
	Name:             "collectApiPullRequestCommits",
	EntryPoint:       CollectApiPullRequestCommits,
	EnabledByDefault: true,
	Description:      "Collect PullRequestCommits data from Gitee api",
	DomainTypes:      []string{core.DOMAIN_TYPE_CODE_REVIEW},
}
View Source
var CollectApiPullRequestReviewsMeta = core.SubTaskMeta{
	Name:             "collectApiPullRequestReviews",
	EntryPoint:       CollectApiPullRequestReviews,
	EnabledByDefault: true,
	Description:      "Collect PullRequestReviews data from Gitee api",
	DomainTypes:      []string{core.DOMAIN_TYPE_CODE_REVIEW},
}
View Source
var CollectApiPullRequestsMeta = core.SubTaskMeta{
	Name:             "collectApiPullRequests",
	EntryPoint:       CollectApiPullRequests,
	EnabledByDefault: true,
	Description:      "Collect PullRequests data from Gitee api",
	DomainTypes:      []string{core.DOMAIN_TYPE_CODE_REVIEW},
}
View Source
var CollectApiRepoMeta = core.SubTaskMeta{
	Name:        "collectApiRepo",
	EntryPoint:  CollectApiRepositories,
	Required:    true,
	Description: "Collect repositories data from Gitee api",
	DomainTypes: []string{core.DOMAIN_TYPE_CODE},
}
View Source
var CollectCommitsMeta = core.SubTaskMeta{
	Name:             "collectApiCommits",
	EntryPoint:       CollectApiCommits,
	EnabledByDefault: true,
	Description:      "Collect commit data from gitee api",
	DomainTypes:      []string{core.DOMAIN_TYPE_CODE, core.DOMAIN_TYPE_CROSS},
}
View Source
var ConvertAccountsMeta = core.SubTaskMeta{
	Name:             "convertAccounts",
	EntryPoint:       ConvertAccounts,
	EnabledByDefault: true,
	Description:      "Convert tool layer table gitee_accounts into  domain layer table accounts",
	DomainTypes:      []string{core.DOMAIN_TYPE_CROSS},
}
View Source
var ConvertCommitsMeta = core.SubTaskMeta{
	Name:             "convertApiCommits",
	EntryPoint:       ConvertCommits,
	EnabledByDefault: true,
	Description:      "Convert tool layer table gitee_commits into  domain layer table commits",
	DomainTypes:      []string{core.DOMAIN_TYPE_CODE, core.DOMAIN_TYPE_CROSS},
}
View Source
var ConvertIssueCommentsMeta = core.SubTaskMeta{
	Name:             "convertIssueComments",
	EntryPoint:       ConvertIssueComments,
	EnabledByDefault: true,
	Description:      "ConvertIssueComments data from Gitee api",
	DomainTypes:      []string{core.DOMAIN_TYPE_TICKET},
}
View Source
var ConvertIssueLabelsMeta = core.SubTaskMeta{
	Name:             "convertIssueLabels",
	EntryPoint:       ConvertIssueLabels,
	EnabledByDefault: true,
	Description:      "Convert tool layer table gitee_issue_labels into  domain layer table issue_labels",
	DomainTypes:      []string{core.DOMAIN_TYPE_TICKET},
}
View Source
var ConvertIssuesMeta = core.SubTaskMeta{
	Name:             "convertIssues",
	EntryPoint:       ConvertIssues,
	EnabledByDefault: true,
	Description:      "Convert tool layer table gitee_issues into  domain layer table issues",
	DomainTypes:      []string{core.DOMAIN_TYPE_TICKET},
}
View Source
var ConvertPullRequestCommentsMeta = core.SubTaskMeta{
	Name:             "convertPullRequestComments",
	EntryPoint:       ConvertPullRequestComments,
	EnabledByDefault: true,
	Description:      "ConvertPullRequestComments data from Gitee api",
	DomainTypes:      []string{core.DOMAIN_TYPE_CODE_REVIEW},
}
View Source
var ConvertPullRequestCommitsMeta = core.SubTaskMeta{
	Name:             "convertPullRequestCommits",
	EntryPoint:       ConvertPullRequestCommits,
	EnabledByDefault: true,
	Description:      "Convert tool layer table gitee_pull_request_commits into  domain layer table pull_request_commits",
	DomainTypes:      []string{core.DOMAIN_TYPE_CODE_REVIEW},
}
View Source
var ConvertPullRequestIssuesMeta = core.SubTaskMeta{
	Name:             "convertPullRequestIssues",
	EntryPoint:       ConvertPullRequestIssues,
	EnabledByDefault: true,
	Description:      "Convert tool layer table gitee_pull_request_issues into  domain layer table pull_request_issues",
	DomainTypes:      []string{core.DOMAIN_TYPE_CROSS},
}
View Source
var ConvertPullRequestLabelsMeta = core.SubTaskMeta{
	Name:             "convertPullRequestLabels",
	EntryPoint:       ConvertPullRequestLabels,
	EnabledByDefault: true,
	Description:      "Convert tool layer table gitee_pull_request_labels into  domain layer table pull_request_labels",
	DomainTypes:      []string{core.DOMAIN_TYPE_CODE_REVIEW},
}
View Source
var ConvertPullRequestsMeta = core.SubTaskMeta{
	Name:             "convertPullRequests",
	EntryPoint:       ConvertPullRequests,
	EnabledByDefault: true,
	Description:      "ConvertPullRequests data from Gitee api",
	DomainTypes:      []string{core.DOMAIN_TYPE_CODE_REVIEW},
}
View Source
var ConvertRepoMeta = core.SubTaskMeta{
	Name:             "convertRepo",
	EntryPoint:       ConvertRepo,
	EnabledByDefault: true,
	Description:      "Convert tool layer table gitee_repos into  domain layer table repos and boards",
	DomainTypes:      []string{core.DOMAIN_TYPE_CODE},
}
View Source
var EnrichPullRequestIssuesMeta = core.SubTaskMeta{
	Name:             "enrichPullRequestIssues",
	EntryPoint:       EnrichPullRequestIssues,
	EnabledByDefault: true,
	Description:      "Create tool layer table gitee_pull_request_issues from gitee_pull_reqeusts",
	DomainTypes:      []string{core.DOMAIN_TYPE_CROSS},
}
View Source
var ExtractApiCommitStatsMeta = core.SubTaskMeta{
	Name:             "extractApiCommitStats",
	EntryPoint:       ExtractApiCommitStats,
	EnabledByDefault: false,
	Description:      "Extract raw commit stats data into tool layer table gitee_commit_stats",
	DomainTypes:      []string{core.DOMAIN_TYPE_CODE},
}
View Source
var ExtractApiIssueCommentsMeta = core.SubTaskMeta{
	Name:             "extractApiIssueComments",
	EntryPoint:       ExtractApiIssueComments,
	EnabledByDefault: true,
	Description: "Extract raw comment data  into tool layer table gitee_pull_request_comments" +
		"and gitee_issue_comments",
	DomainTypes: []string{core.DOMAIN_TYPE_TICKET},
}
View Source
var ExtractApiIssuesMeta = core.SubTaskMeta{
	Name:             "extractApiIssues",
	EntryPoint:       ExtractApiIssues,
	EnabledByDefault: true,
	Description:      "Extract raw Issues data into tool layer table gitee_issues",
	DomainTypes:      []string{core.DOMAIN_TYPE_TICKET},
}
View Source
var ExtractApiPullRequestCommitsMeta = core.SubTaskMeta{
	Name:             "extractApiPullRequestCommits",
	EntryPoint:       ExtractApiPullRequestCommits,
	EnabledByDefault: true,
	Description:      "Extract raw PullRequestCommits data into tool layer table gitee_commits",
	DomainTypes:      []string{core.DOMAIN_TYPE_CODE_REVIEW},
}
View Source
var ExtractApiPullRequestReviewsMeta = core.SubTaskMeta{
	Name:             "extractApiPullRequestReviews",
	EntryPoint:       ExtractApiPullRequestReviews,
	EnabledByDefault: true,
	Description:      "Extract raw PullRequestReviews data into tool layer table gitee_reviewers",
	DomainTypes:      []string{core.DOMAIN_TYPE_CODE_REVIEW},
}
View Source
var ExtractApiPullRequestsMeta = core.SubTaskMeta{
	Name:             "extractApiPullRequests",
	EntryPoint:       ExtractApiPullRequests,
	EnabledByDefault: true,
	Description:      "Extract raw PullRequests data into tool layer table gitee_pull_requests",
	DomainTypes:      []string{core.DOMAIN_TYPE_CODE_REVIEW},
}
View Source
var ExtractApiRepoMeta = core.SubTaskMeta{
	Name:        "extractApiRepo",
	EntryPoint:  ExtractApiRepositories,
	Required:    true,
	Description: "Extract raw Repositories data into tool layer table gitee_repos",
	DomainTypes: []string{core.DOMAIN_TYPE_CODE},
}
View Source
var ExtractCommitsMeta = core.SubTaskMeta{
	Name:             "extractApiCommits",
	EntryPoint:       ExtractApiCommits,
	EnabledByDefault: true,
	Description:      "Extract raw commit data into tool layer table GiteeCommit,GiteeAccount and GiteeRepoCommit",
	DomainTypes:      []string{core.DOMAIN_TYPE_CODE, core.DOMAIN_TYPE_CROSS},
}

Functions

func CollectApiCommitStats

func CollectApiCommitStats(taskCtx core.SubTaskContext) error

func CollectApiCommits

func CollectApiCommits(taskCtx core.SubTaskContext) error

func CollectApiIssueComments

func CollectApiIssueComments(taskCtx core.SubTaskContext) error

func CollectApiIssues

func CollectApiIssues(taskCtx core.SubTaskContext) error

func CollectApiPullRequestCommits

func CollectApiPullRequestCommits(taskCtx core.SubTaskContext) error

func CollectApiPullRequestReviews

func CollectApiPullRequestReviews(taskCtx core.SubTaskContext) error

func CollectApiPullRequests

func CollectApiPullRequests(taskCtx core.SubTaskContext) error

func CollectApiRepositories

func CollectApiRepositories(taskCtx core.SubTaskContext) error

func ConvertAccounts

func ConvertAccounts(taskCtx core.SubTaskContext) error

func ConvertCommit

func ConvertCommit(commit *GiteeApiCommitResponse) (*models.GiteeCommit, error)

ConvertCommit Convert the API response to our DB model instance

func ConvertCommits

func ConvertCommits(taskCtx core.SubTaskContext) error

func ConvertIssueComments

func ConvertIssueComments(taskCtx core.SubTaskContext) error

func ConvertIssueLabels

func ConvertIssueLabels(taskCtx core.SubTaskContext) error

func ConvertIssues

func ConvertIssues(taskCtx core.SubTaskContext) error

func ConvertPullRequestComments

func ConvertPullRequestComments(taskCtx core.SubTaskContext) error

func ConvertPullRequestCommits

func ConvertPullRequestCommits(taskCtx core.SubTaskContext) (err error)

func ConvertPullRequestIssues

func ConvertPullRequestIssues(taskCtx core.SubTaskContext) error

func ConvertPullRequestLabels

func ConvertPullRequestLabels(taskCtx core.SubTaskContext) error

func ConvertPullRequests

func ConvertPullRequests(taskCtx core.SubTaskContext) error

func ConvertRepo

func ConvertRepo(taskCtx core.SubTaskContext) error

func ConvertStringToInt

func ConvertStringToInt(input string) (int, error)

func EnrichPullRequestIssues

func EnrichPullRequestIssues(taskCtx core.SubTaskContext) (err error)

func ExtractApiCommitStats

func ExtractApiCommitStats(taskCtx core.SubTaskContext) error

func ExtractApiCommits

func ExtractApiCommits(taskCtx core.SubTaskContext) error

func ExtractApiIssueComments

func ExtractApiIssueComments(taskCtx core.SubTaskContext) error

func ExtractApiIssues

func ExtractApiIssues(taskCtx core.SubTaskContext) error

func ExtractApiPullRequestCommits

func ExtractApiPullRequestCommits(taskCtx core.SubTaskContext) error

func ExtractApiPullRequestReviews

func ExtractApiPullRequestReviews(taskCtx core.SubTaskContext) error

func ExtractApiPullRequests

func ExtractApiPullRequests(taskCtx core.SubTaskContext) error

func ExtractApiRepositories

func ExtractApiRepositories(taskCtx core.SubTaskContext) error

func GetRateLimitPerSecond

func GetRateLimitPerSecond(info RateLimitInfo) int

func GetRawMessageFromResponse

func GetRawMessageFromResponse(res *http.Response) ([]json.RawMessage, error)

func GetTotalPagesFromResponse

func GetTotalPagesFromResponse(res *http.Response, args *helper.ApiCollectorArgs) (int, error)

func NewGiteeApiClient

func NewGiteeApiClient(taskCtx core.TaskContext, connection *models.GiteeConnection) (*helper.ApiAsyncClient, error)

Types

type ApiSingleCommitResponse

type ApiSingleCommitResponse struct {
	Sha   string
	Stats struct {
		Additions int
		Deletions int
		// contains filtered or unexported fields
	}
	Commit struct {
		Committer struct {
			Name  string
			Email string
			Date  helper.Iso8601Time
		}
	}
}

type GiteeApiCommitResponse

type GiteeApiCommitResponse struct {
	Author      *models.GiteeAccount `json:"author"`
	CommentsUrl string               `json:"comments_url"`
	Commit      GiteeCommit          `json:"commit"`
	Committer   *models.GiteeAccount `json:"committer"`
	HtmlUrl     string               `json:"html_url"`
	Sha         string               `json:"sha"`
	Url         string               `json:"url"`
}

type GiteeApiParams

type GiteeApiParams struct {
	ConnectionId uint64
	Repo         string
	Owner        string
}

type GiteeApiPullResponse

type GiteeApiPullResponse struct {
	GiteeId int `json:"id"`
	Number  int
	State   string
	Title   string
	Body    json.RawMessage
	HtmlUrl string `json:"html_url"`
	Labels  []struct {
		Name string `json:"name"`
	} `json:"labels"`
	Assignee *struct {
		Id    int
		Login string
		Name  string
	}
	User *struct {
		Id    int
		Login string
		Name  string
	}
	ClosedAt       *helper.Iso8601Time `json:"closed_at"`
	MergedAt       *helper.Iso8601Time `json:"merged_at"`
	GiteeCreatedAt helper.Iso8601Time  `json:"created_at"`
	GiteeUpdatedAt helper.Iso8601Time  `json:"updated_at"`
	MergeCommitSha string              `json:"merge_commit_sha"`
	Head           struct {
		Ref string
		Sha string
	}
	Base struct {
		Ref  string
		Sha  string
		Repo struct {
			Id      int
			Name    string
			Url     string
			HtmlUrl string
			SshUrl  string `json:"ssh_url"`
		}
	}
}

type GiteeApiRepoResponse

type GiteeApiRepoResponse struct {
	Name        string                `json:"name"`
	GiteeId     int                   `json:"id"`
	HTMLUrl     string                `json:"html_url"`
	Language    string                `json:"language"`
	Description string                `json:"description"`
	Owner       models.GiteeAccount   `json:"owner"`
	Parent      *GiteeApiRepoResponse `json:"parent"`
	CreatedAt   helper.Iso8601Time    `json:"created_at"`
	UpdatedAt   *helper.Iso8601Time   `json:"updated_at"`
}

type GiteeCommit

type GiteeCommit struct {
	Author struct {
		Date  helper.Iso8601Time `json:"date"`
		Email string             `json:"email"`
		Name  string             `json:"name"`
	}
	Committer struct {
		Date  helper.Iso8601Time `json:"date"`
		Email string             `json:"email"`
		Name  string             `json:"name"`
	}
	Message string `json:"message"`
}

type GiteeInput

type GiteeInput struct {
	Repo  string
	Owner string
	Iid   int
}

type GiteeOptions

type GiteeOptions struct {
	ConnectionId               uint64   `json:"connectionId"`
	Tasks                      []string `json:"tasks,omitempty"`
	Since                      string
	Owner                      string
	Repo                       string
	Token                      string
	models.TransformationRules `mapstructure:"transformationRules" json:"transformationRules"`
}

type GiteeTaskData

type GiteeTaskData struct {
	Options   *GiteeOptions
	ApiClient *helper.ApiAsyncClient
	Repo      *models.GiteeRepo
	Since     *time.Time
}

func CreateRawDataSubTaskArgs

func CreateRawDataSubTaskArgs(taskCtx core.SubTaskContext, Table string) (*helper.RawDataSubTaskArgs, *GiteeTaskData)

type IssueComment

type IssueComment struct {
	GiteeId int `json:"id"`
	Body    string

	User struct {
		Login string
		Id    int
	}

	Target struct {
		Issue struct {
			Id     int    `json:"id"`
			Title  string `json:"title"`
			Number string `json:"number"`
		}
		PullRequest string `json:"pull_request"`
	}

	GiteeCreatedAt helper.Iso8601Time `json:"created_at"`
	GiteeUpdatedAt helper.Iso8601Time `json:"updated_at"`
}

type IssuesResponse

type IssuesResponse struct {
	GiteeId       int    `json:"id"`
	Url           string `json:"url"`
	RepositoryUrl string `json:"repository_url"`
	Number        string `json:"number"`
	State         string `json:"state"`
	Title         string
	Body          string
	HtmlUrl       string `json:"html_url"`
	CommentsUrl   string `json:"comments_url"`
	PullRequest   struct {
		Url     string `json:"url"`
		HtmlUrl string `json:"html_url"`
	} `json:"pull_request"`
	Labels []struct {
		Id           int
		RepositoryId int                `json:"repository_id"`
		Name         string             `json:"name"`
		CreatedAt    helper.Iso8601Time `json:"created_at"`
		UpdatedAt    helper.Iso8601Time `json:"updated_at"`
	} `json:"labels"`
	Repository struct {
		Id       int
		FullName string `json:"full_name"`
		Url      string `json:"url"`
	} `json:"repository"`
	Assignee *struct {
		Login string
		Id    int
	}
	User *struct {
		Login string
		Id    int
		Name  string
	}
	Comments        int                 `json:"comments"`
	Priority        int                 `json:"priority"`
	IssueType       string              `json:"issue_type"`
	SecurityHole    bool                `json:"security_hole"`
	IssueState      string              `json:"issue_state"`
	Branch          string              `json:"branch"`
	FinishAt        *helper.Iso8601Time `json:"finished_at"`
	GiteeCreatedAt  helper.Iso8601Time  `json:"created_at"`
	GiteeUpdatedAt  helper.Iso8601Time  `json:"updated_at"`
	IssueTypeDetail struct {
		Id        int
		Title     string
		Ident     string
		CreatedAt helper.Iso8601Time `json:"created_at"`
		UpdatedAt helper.Iso8601Time `json:"updated_at"`
	}
	IssueStateDetail struct {
		Id        int
		Title     string
		Serial    string
		CreatedAt helper.Iso8601Time `json:"created_at"`
		UpdatedAt helper.Iso8601Time `json:"updated_at"`
	}
}

type PagingInfo

type PagingInfo struct {
	Next  int
	Last  int
	First int
	Prev  int
}

func GetPagingFromLinkHeader

func GetPagingFromLinkHeader(link string) (PagingInfo, error)

type PrCommitsResponse

type PrCommitsResponse struct {
	Sha    string `json:"sha"`
	Commit PullRequestCommit
	Url    string
	Author struct {
		Id    int
		Login string
		Name  string
	}
	Committer struct {
		Id    int
		Login string
		Name  string
	}
}

type PullRequestCommit

type PullRequestCommit struct {
	Author struct {
		Name  string
		Email string
		Date  helper.Iso8601Time
	}
	Committer struct {
		Name  string
		Email string
		Date  helper.Iso8601Time
	}
	Message      string
	CommentCount int `json:"comment_count"`
}

type PullRequestReview

type PullRequestReview struct {
	GiteeId int `json:"id"`
	User    struct {
		Id    int
		Login string
		Name  string
	}
	Content    string
	ActionType string             `json:"action_type"`
	CreatedAt  helper.Iso8601Time `json:"created_at"`
}

type RateLimitInfo

type RateLimitInfo struct {
	Date      time.Time
	ResetTime time.Time
	Remaining int
}

func ConvertRateLimitInfo

func ConvertRateLimitInfo(date string, resetTime string, remaining string) (RateLimitInfo, error)

type SimplePr

type SimplePr struct {
	Number  int
	GiteeId int
}

Jump to

Keyboard shortcuts

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