{"modulePath":"github.com/RedAFD/code-core","version":"v1.14.0-rc8","isLatest":false,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package base\n\n## Constants\n\n```go\nconst (\n\tReviewStatePending          = \"PENDING\"\n\tReviewStateApproved         = \"APPROVED\"\n\tReviewStateChangesRequested = \"CHANGES_REQUESTED\"\n\tReviewStateCommented        = \"COMMENTED\"\n)\n```\nenumerate all review states\n\n## Functions\n\n```go\nfunc IsErrNotSupported(err error) bool\n```\nIsErrNotSupported checks if an error is an ErrNotSupported\n\n## Types\n\n```go\ntype Comment struct {\n\tIssueIndex  int64  `yaml:\"issue_index\"`\n\tPosterID    int64  `yaml:\"poster_id\"`\n\tPosterName  string `yaml:\"poster_name\"`\n\tPosterEmail string `yaml:\"poster_email\"`\n\tCreated     time.Time\n\tUpdated     time.Time\n\tContent     string\n\tReactions   []*Reaction\n}\n```\nComment is a standard comment information\n\n```go\ntype Downloader interface {\n\tSetContext(context.Context)\n\tGetRepoInfo() (*Repository, error)\n\tGetTopics() ([]string, error)\n\tGetMilestones() ([]*Milestone, error)\n\tGetReleases() ([]*Release, error)\n\tGetLabels() ([]*Label, error)\n\tGetIssues(page, perPage int) ([]*Issue, bool, error)\n\tGetComments(issueNumber int64) ([]*Comment, error)\n\tGetPullRequests(page, perPage int) ([]*PullRequest, bool, error)\n\tGetReviews(pullRequestNumber int64) ([]*Review, error)\n\tFormatCloneURL(opts MigrateOptions, remoteAddr string) (string, error)\n}\n```\nDownloader downloads the site repo informations\n\n```go\ntype DownloaderFactory interface {\n\tNew(ctx context.Context, opts MigrateOptions) (Downloader, error)\n\tGitServiceType() structs.GitServiceType\n}\n```\nDownloaderFactory defines an interface to match a downloader implementation and create a downloader\n\n```go\ntype ErrNotSupported struct {\n\tEntity string\n}\n```\nErrNotSupported represents status if a downloader do not supported something.\n\n```go\nfunc (err ErrNotSupported) Error() string\n```\nError return error message\n\n```go\ntype Issue struct {\n\tNumber      int64\n\tPosterID    int64  `yaml:\"poster_id\"`\n\tPosterName  string `yaml:\"poster_name\"`\n\tPosterEmail string `yaml:\"poster_email\"`\n\tTitle       string\n\tContent     string\n\tRef         string\n\tMilestone   string\n\tState       string // closed, open\n\tIsLocked    bool   `yaml:\"is_locked\"`\n\tCreated     time.Time\n\tUpdated     time.Time\n\tClosed      *time.Time\n\tLabels      []*Label\n\tReactions   []*Reaction\n\tAssignees   []string\n}\n```\nIssue is a standard issue information\n\n```go\ntype Label struct {\n\tName        string\n\tColor       string\n\tDescription string\n}\n```\nLabel defines a standard label informations\n\n```go\ntype MigrateOptions struct {\n\t// required: true\n\tCloneAddr    string `json:\"clone_addr\" binding:\"Required\"`\n\tAuthUsername string `json:\"auth_username\"`\n\tAuthPassword string `json:\"auth_password\"`\n\tAuthToken    string `json:\"auth_token\"`\n\t// required: true\n\tUID int `json:\"uid\" binding:\"Required\"`\n\t// required: true\n\tRepoName        string `json:\"repo_name\" binding:\"Required\"`\n\tMirror          bool   `json:\"mirror\"`\n\tPrivate         bool   `json:\"private\"`\n\tDescription     string `json:\"description\"`\n\tOriginalURL     string\n\tGitServiceType  structs.GitServiceType\n\tWiki            bool\n\tIssues          bool\n\tMilestones      bool\n\tLabels          bool\n\tReleases        bool\n\tComments        bool\n\tPullRequests    bool\n\tReleaseAssets   bool\n\tMigrateToRepoID int64\n\tMirrorInterval  string `json:\"mirror_interval\"`\n}\n```\nMigrateOptions defines the way a repository gets migrated this is for internal usage by migrations module and func who interact with it\n\n```go\ntype Milestone struct {\n\tTitle       string\n\tDescription string\n\tDeadline    *time.Time\n\tCreated     time.Time\n\tUpdated     *time.Time\n\tClosed      *time.Time\n\tState       string // open, closed\n}\n```\nMilestone defines a standard milestone\n\n```go\ntype NullDownloader struct {\n}\n```\nNullDownloader implements a blank downloader\n\n```go\nfunc (n NullDownloader) FormatCloneURL(opts MigrateOptions, remoteAddr string) (string, error)\n```\nFormatCloneURL add authentification into remote URLs\n\n```go\nfunc (n NullDownloader) GetComments(issueNumber int64) ([]*Comment, error)\n```\nGetComments returns comments according issueNumber\n\n```go\nfunc (n NullDownloader) GetIssues(page, perPage int) ([]*Issue, bool, error)\n```\nGetIssues returns issues according start and limit\n\n```go\nfunc (n NullDownloader) GetLabels() ([]*Label, error)\n```\nGetLabels returns labels\n\n```go\nfunc (n NullDownloader) GetMilestones() ([]*Milestone, error)\n```\nGetMilestones returns milestones\n\n```go\nfunc (n NullDownloader) GetPullRequests(page, perPage int) ([]*PullRequest, bool, error)\n```\nGetPullRequests returns pull requests according page and perPage\n\n```go\nfunc (n NullDownloader) GetReleases() ([]*Release, error)\n```\nGetReleases returns releases\n\n```go\nfunc (n NullDownloader) GetRepoInfo() (*Repository, error)\n```\nGetRepoInfo returns a repository information\n\n```go\nfunc (n NullDownloader) GetReviews(pullRequestNumber int64) ([]*Review, error)\n```\nGetReviews returns pull requests review\n\n```go\nfunc (n NullDownloader) GetTopics() ([]string, error)\n```\nGetTopics return repository topics\n\n```go\nfunc (n NullDownloader) SetContext(_ context.Context)\n```\nSetContext set context\n\n```go\ntype PullRequest struct {\n\tNumber         int64\n\tOriginalNumber int64 `yaml:\"original_number\"`\n\tTitle          string\n\tPosterName     string `yaml:\"poster_name\"`\n\tPosterID       int64  `yaml:\"poster_id\"`\n\tPosterEmail    string `yaml:\"poster_email\"`\n\tContent        string\n\tMilestone      string\n\tState          string\n\tCreated        time.Time\n\tUpdated        time.Time\n\tClosed         *time.Time\n\tLabels         []*Label\n\tPatchURL       string `yaml:\"patch_url\"`\n\tMerged         bool\n\tMergedTime     *time.Time `yaml:\"merged_time\"`\n\tMergeCommitSHA string     `yaml:\"merge_commit_sha\"`\n\tHead           PullRequestBranch\n\tBase           PullRequestBranch\n\tAssignees      []string\n\tIsLocked       bool `yaml:\"is_locked\"`\n\tReactions      []*Reaction\n}\n```\nPullRequest defines a standard pull request information\n\n```go\nfunc (p *PullRequest) IsForkPullRequest() bool\n```\nIsForkPullRequest returns true if the pull request from a forked repository but not the same repository\n\n```go\ntype PullRequestBranch struct {\n\tCloneURL  string `yaml:\"clone_url\"`\n\tRef       string\n\tSHA       string\n\tRepoName  string `yaml:\"repo_name\"`\n\tOwnerName string `yaml:\"owner_name\"`\n}\n```\nPullRequestBranch represents a pull request branch\n\n```go\nfunc (p PullRequestBranch) RepoPath() string\n```\nRepoPath returns pull request repo path\n\n```go\ntype Reaction struct {\n\tUserID   int64  `yaml:\"user_id\"`\n\tUserName string `yaml:\"user_name\"`\n\tContent  string\n}\n```\nReaction represents a reaction to an issue/pr/comment.\n\n```go\ntype Release struct {\n\tTagName         string `yaml:\"tag_name\"`\n\tTargetCommitish string `yaml:\"target_commitish\"`\n\tName            string\n\tBody            string\n\tDraft           bool\n\tPrerelease      bool\n\tPublisherID     int64  `yaml:\"publisher_id\"`\n\tPublisherName   string `yaml:\"publisher_name\"`\n\tPublisherEmail  string `yaml:\"publisher_email\"`\n\tAssets          []*ReleaseAsset\n\tCreated         time.Time\n\tPublished       time.Time\n}\n```\nRelease represents a release\n\n```go\ntype ReleaseAsset struct {\n\tID            int64\n\tName          string\n\tContentType   *string `yaml:\"content_type\"`\n\tSize          *int\n\tDownloadCount *int `yaml:\"download_count\"`\n\tCreated       time.Time\n\tUpdated       time.Time\n\tDownloadURL   *string `yaml:\"download_url\"`\n\t// if DownloadURL is nil, the function should be invoked\n\tDownloadFunc func() (io.ReadCloser, error) `yaml:\"-\"`\n}\n```\nReleaseAsset represents a release asset\n\n```go\ntype Repository struct {\n\tName          string\n\tOwner         string\n\tIsPrivate     bool `yaml:\"is_private\"`\n\tIsMirror      bool `yaml:\"is_mirror\"`\n\tDescription   string\n\tCloneURL      string `yaml:\"clone_url\"`\n\tOriginalURL   string `yaml:\"original_url\"`\n\tDefaultBranch string\n}\n```\nRepository defines a standard repository information\n\n```go\ntype RetryDownloader struct {\n\tDownloader\n\n\tRetryTimes int // the total execute times\n\tRetryDelay int // time to delay seconds\n\t// contains filtered or unexported fields\n}\n```\nRetryDownloader retry the downloads\n\n```go\nfunc NewRetryDownloader(ctx context.Context, downloader Downloader, retryTimes, retryDelay int) *RetryDownloader\n```\nNewRetryDownloader creates a retry downloader\n\n```go\nfunc (d *RetryDownloader) GetComments(issueNumber int64) ([]*Comment, error)\n```\nGetComments returns a repository's comments with retry\n\n```go\nfunc (d *RetryDownloader) GetIssues(page, perPage int) ([]*Issue, bool, error)\n```\nGetIssues returns a repository's issues with retry\n\n```go\nfunc (d *RetryDownloader) GetLabels() ([]*Label, error)\n```\nGetLabels returns a repository's labels with retry\n\n```go\nfunc (d *RetryDownloader) GetMilestones() ([]*Milestone, error)\n```\nGetMilestones returns a repository's milestones with retry\n\n```go\nfunc (d *RetryDownloader) GetPullRequests(page, perPage int) ([]*PullRequest, bool, error)\n```\nGetPullRequests returns a repository's pull requests with retry\n\n```go\nfunc (d *RetryDownloader) GetReleases() ([]*Release, error)\n```\nGetReleases returns a repository's releases with retry\n\n```go\nfunc (d *RetryDownloader) GetRepoInfo() (*Repository, error)\n```\nGetRepoInfo returns a repository information with retry\n\n```go\nfunc (d *RetryDownloader) GetReviews(pullRequestNumber int64) ([]*Review, error)\n```\nGetReviews returns pull requests reviews\n\n```go\nfunc (d *RetryDownloader) GetTopics() ([]string, error)\n```\nGetTopics returns a repository's topics with retry\n\n```go\nfunc (d *RetryDownloader) SetContext(ctx context.Context)\n```\nSetContext set context\n\n```go\ntype Review struct {\n\tID           int64\n\tIssueIndex   int64  `yaml:\"issue_index\"`\n\tReviewerID   int64  `yaml:\"reviewer_id\"`\n\tReviewerName string `yaml:\"reviewer_name\"`\n\tOfficial     bool\n\tCommitID     string `yaml:\"commit_id\"`\n\tContent      string\n\tCreatedAt    time.Time `yaml:\"created_at\"`\n\tState        string    // PENDING, APPROVED, REQUEST_CHANGES, or COMMENT\n\tComments     []*ReviewComment\n}\n```\nReview is a standard review information\n\n```go\ntype ReviewComment struct {\n\tID        int64\n\tInReplyTo int64 `yaml:\"in_reply_to\"`\n\tContent   string\n\tTreePath  string `yaml:\"tree_path\"`\n\tDiffHunk  string `yaml:\"diff_hunk\"`\n\tPosition  int\n\tLine      int\n\tCommitID  string `yaml:\"commit_id\"`\n\tPosterID  int64  `yaml:\"poster_id\"`\n\tReactions []*Reaction\n\tCreatedAt time.Time `yaml:\"created_at\"`\n\tUpdatedAt time.Time `yaml:\"updated_at\"`\n}\n```\nReviewComment represents a review comment\n\n```go\ntype Uploader interface {\n\tMaxBatchInsertSize(tp string) int\n\tCreateRepo(repo *Repository, opts MigrateOptions) error\n\tCreateTopics(topic ...string) error\n\tCreateMilestones(milestones ...*Milestone) error\n\tCreateReleases(releases ...*Release) error\n\tSyncTags() error\n\tCreateLabels(labels ...*Label) error\n\tCreateIssues(issues ...*Issue) error\n\tCreateComments(comments ...*Comment) error\n\tCreatePullRequests(prs ...*PullRequest) error\n\tCreateReviews(reviews ...*Review) error\n\tRollback() error\n\tFinish() error\n\tClose()\n}\n```\nUploader uploads all the informations of one repository\n\n","path":"github.com/RedAFD/code-core/modules/migrations/base","name":"base","synopsis":"","isRedistributable":true}
