gitea: code.gitea.io/gitea/modules/migrations/base Index | Files

package base

import "code.gitea.io/gitea/modules/migrations/base"

Index

Package Files

comment.go downloader.go issue.go label.go milestone.go options.go pullrequest.go reaction.go release.go repo.go review.go uploader.go

Constants

const (
    ReviewStatePending          = "PENDING"
    ReviewStateApproved         = "APPROVED"
    ReviewStateChangesRequested = "CHANGES_REQUESTED"
    ReviewStateCommented        = "COMMENTED"
)

enumerate all review states

type Comment Uses

type Comment struct {
    IssueIndex  int64
    PosterID    int64
    PosterName  string
    PosterEmail string
    Created     time.Time
    Updated     time.Time
    Content     string
    Reactions   []*Reaction
}

Comment is a standard comment information

type Downloader Uses

type Downloader interface {
    SetContext(context.Context)
    GetRepoInfo() (*Repository, error)
    GetTopics() ([]string, error)
    GetMilestones() ([]*Milestone, error)
    GetReleases() ([]*Release, error)
    GetLabels() ([]*Label, error)
    GetIssues(page, perPage int) ([]*Issue, bool, error)
    GetComments(issueNumber int64) ([]*Comment, error)
    GetPullRequests(page, perPage int) ([]*PullRequest, error)
    GetReviews(pullRequestNumber int64) ([]*Review, error)
}

Downloader downloads the site repo informations

type DownloaderFactory Uses

type DownloaderFactory interface {
    Match(opts MigrateOptions) (bool, error)
    New(opts MigrateOptions) (Downloader, error)
    GitServiceType() structs.GitServiceType
}

DownloaderFactory defines an interface to match a downloader implementation and create a downloader

type Issue Uses

type Issue struct {
    Number      int64
    PosterID    int64
    PosterName  string
    PosterEmail string
    Title       string
    Content     string
    Milestone   string
    State       string // closed, open
    IsLocked    bool
    Created     time.Time
    Updated     time.Time
    Closed      *time.Time
    Labels      []*Label
    Reactions   []*Reaction
}

Issue is a standard issue information

type Label Uses

type Label struct {
    Name        string
    Color       string
    Description string
}

Label defines a standard label informations

type MigrateOptions Uses

type MigrateOptions = structs.MigrateRepoOption

MigrateOptions defines the way a repository gets migrated

type Milestone Uses

type Milestone struct {
    Title       string
    Description string
    Deadline    *time.Time
    Created     time.Time
    Updated     *time.Time
    Closed      *time.Time
    State       string
}

Milestone defines a standard milestone

type PullRequest Uses

type PullRequest struct {
    Number         int64
    OriginalNumber int64
    Title          string
    PosterName     string
    PosterID       int64
    PosterEmail    string
    Content        string
    Milestone      string
    State          string
    Created        time.Time
    Updated        time.Time
    Closed         *time.Time
    Labels         []*Label
    PatchURL       string
    Merged         bool
    MergedTime     *time.Time
    MergeCommitSHA string
    Head           PullRequestBranch
    Base           PullRequestBranch
    Assignee       string
    Assignees      []string
    IsLocked       bool
    Reactions      []*Reaction
}

PullRequest defines a standard pull request information

func (*PullRequest) IsForkPullRequest Uses

func (p *PullRequest) IsForkPullRequest() bool

IsForkPullRequest returns true if the pull request from a forked repository but not the same repository

type PullRequestBranch Uses

type PullRequestBranch struct {
    CloneURL  string
    Ref       string
    SHA       string
    RepoName  string
    OwnerName string
}

PullRequestBranch represents a pull request branch

func (PullRequestBranch) RepoPath Uses

func (p PullRequestBranch) RepoPath() string

RepoPath returns pull request repo path

type Reaction Uses

type Reaction struct {
    UserID   int64
    UserName string
    Content  string
}

Reaction represents a reaction to an issue/pr/comment.

type Release Uses

type Release struct {
    TagName         string
    TargetCommitish string
    Name            string
    Body            string
    Draft           bool
    Prerelease      bool
    PublisherID     int64
    PublisherName   string
    PublisherEmail  string
    Assets          []ReleaseAsset
    Created         time.Time
    Published       time.Time
}

Release represents a release

type ReleaseAsset Uses

type ReleaseAsset struct {
    URL           string
    Name          string
    ContentType   *string
    Size          *int
    DownloadCount *int
    Created       time.Time
    Updated       time.Time
}

ReleaseAsset represents a release asset

type Repository Uses

type Repository struct {
    Name         string
    Owner        string
    IsPrivate    bool
    IsMirror     bool
    Description  string
    AuthUsername string
    AuthPassword string
    CloneURL     string
    OriginalURL  string
}

Repository defines a standard repository information

type RetryDownloader Uses

type RetryDownloader struct {
    Downloader
    RetryTimes int // the total execute times
    RetryDelay int // time to delay seconds
}

RetryDownloader retry the downloads

func NewRetryDownloader Uses

func NewRetryDownloader(downloader Downloader, retryTimes, retryDelay int) *RetryDownloader

NewRetryDownloader creates a retry downloader

func (*RetryDownloader) GetComments Uses

func (d *RetryDownloader) GetComments(issueNumber int64) ([]*Comment, error)

GetComments returns a repository's comments with retry

func (*RetryDownloader) GetIssues Uses

func (d *RetryDownloader) GetIssues(page, perPage int) ([]*Issue, bool, error)

GetIssues returns a repository's issues with retry

func (*RetryDownloader) GetLabels Uses

func (d *RetryDownloader) GetLabels() ([]*Label, error)

GetLabels returns a repository's labels with retry

func (*RetryDownloader) GetMilestones Uses

func (d *RetryDownloader) GetMilestones() ([]*Milestone, error)

GetMilestones returns a repository's milestones with retry

func (*RetryDownloader) GetPullRequests Uses

func (d *RetryDownloader) GetPullRequests(page, perPage int) ([]*PullRequest, error)

GetPullRequests returns a repository's pull requests with retry

func (*RetryDownloader) GetReleases Uses

func (d *RetryDownloader) GetReleases() ([]*Release, error)

GetReleases returns a repository's releases with retry

func (*RetryDownloader) GetRepoInfo Uses

func (d *RetryDownloader) GetRepoInfo() (*Repository, error)

GetRepoInfo returns a repository information with retry

func (*RetryDownloader) GetReviews Uses

func (d *RetryDownloader) GetReviews(pullRequestNumber int64) ([]*Review, error)

GetReviews returns pull requests reviews

func (*RetryDownloader) GetTopics Uses

func (d *RetryDownloader) GetTopics() ([]string, error)

GetTopics returns a repository's topics with retry

func (*RetryDownloader) SetContext Uses

func (d *RetryDownloader) SetContext(ctx context.Context)

SetContext set context

type Review Uses

type Review struct {
    ID           int64
    IssueIndex   int64
    ReviewerID   int64
    ReviewerName string
    Official     bool
    CommitID     string
    Content      string
    CreatedAt    time.Time
    State        string // PENDING, APPROVED, REQUEST_CHANGES, or COMMENT
    Comments     []*ReviewComment
}

Review is a standard review information

type ReviewComment Uses

type ReviewComment struct {
    ID        int64
    InReplyTo int64
    Content   string
    TreePath  string
    DiffHunk  string
    Position  int
    CommitID  string
    PosterID  int64
    Reactions []*Reaction
    CreatedAt time.Time
    UpdatedAt time.Time
}

ReviewComment represents a review comment

type Uploader Uses

type Uploader interface {
    MaxBatchInsertSize(tp string) int
    CreateRepo(repo *Repository, opts MigrateOptions) error
    CreateTopics(topic ...string) error
    CreateMilestones(milestones ...*Milestone) error
    CreateReleases(releases ...*Release) error
    SyncTags() error
    CreateLabels(labels ...*Label) error
    CreateIssues(issues ...*Issue) error
    CreateComments(comments ...*Comment) error
    CreatePullRequests(prs ...*PullRequest) error
    CreateReviews(reviews ...*Review) error
    Rollback() error
    Close()
}

Uploader uploads all the informations of one repository

Package base imports 4 packages (graph) and is imported by 8 packages. Updated 2020-06-14. Refresh now. Tools for package owners.