remote

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2023 License: ISC Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Branch

type Branch struct {
	Name   string
	Commit Commit
}

Branch represents a branch.

func (Branch) String

func (b Branch) String() string

type Change

type Change struct {
	Number    int
	Title     string
	Labels    Labels
	Milestone string
	Time      time.Time
	Author    User
	WebURL    string
}

Change has the common fields of an issue or a merge/pull request.

type Commit

type Commit struct {
	Hash string
	Time time.Time
}

Commit represents a commit.

func (Commit) IsZero

func (c Commit) IsZero() bool

IsZero determines if a commit is a zero commit instance.

func (Commit) String

func (c Commit) String() string

type Commits

type Commits []Commit

Commits is a collection of commits.

func (Commits) Any

func (c Commits) Any(hash string) bool

Any returns true if at least one of the commits is equal to the given commit.

func (Commits) Map

func (c Commits) Map(f func(c Commit) string) []string

Map converts a list of commits to a list of strings.

type Issue

type Issue struct {
	Change
	Closer User
}

Issue represents an issue.

type Issues

type Issues []Issue

Issues is a collection of issues.

func (Issues) Milestones

func (i Issues) Milestones() []string

Milestones returns a sorted list of all milestones in the collection of issues.

func (Issues) Select

func (i Issues) Select(f func(Issue) bool) (Issues, Issues)

Select returns a new collection of issues that satisfies the predicate f. The first return value is the collection of selected issues. The second return value is the collection of unselected issues.

func (Issues) Sort

func (i Issues) Sort() Issues

Sort sorts the collection of issues from the most recent to the least recent.

type Labels

type Labels []string

Labels is a collection of labels.

func (Labels) Any

func (l Labels) Any(names ...string) bool

Any returns true if one of the labels is equal to any of the given names.

func (Labels) String

func (l Labels) String() string

type Merge

type Merge struct {
	Change
	Merger User
	Commit Commit
}

Merge represents a merge/pull request.

type Merges

type Merges []Merge

Merges is a collection of merges.

func (Merges) Milestones

func (m Merges) Milestones() []string

Milestones returns a sorted list of all milestones in the collection of merges.

func (Merges) Select

func (m Merges) Select(f func(Merge) bool) (Merges, Merges)

Select returns a new collection of merges that satisfies the predicate f. The first return value is the collection of selected merges. The second return value is the collection of unselected merges.

func (Merges) Sort

func (m Merges) Sort() Merges

Sort sorts the collection of merges from the most recent to the least recent.

type Repo

type Repo interface {
	// FutureTag returns a tag that does not exist yet.
	FutureTag(string) Tag
	// CompareURL returns a URL for comparing two revisions.
	CompareURL(string, string) string
	// CheckPermissions ensures the client has all the required permissions.
	CheckPermissions(context.Context) error
	// FetchFirstCommit retrieves the firist/initial commit.
	FetchFirstCommit(context.Context) (Commit, error)
	// FetchBranch retrieves a branch by name.
	FetchBranch(context.Context, string) (Branch, error)
	// FetchDefaultBranch retrieves the default branch.
	FetchDefaultBranch(context.Context) (Branch, error)
	// FetchTags retrieves all tags.
	FetchTags(context.Context) (Tags, error)
	// FetchIssuesAndMerges retrieves closed issues and merged pull/merge requests.
	FetchIssuesAndMerges(context.Context, time.Time) (Issues, Merges, error)
	// FetchParentCommits retrieves all parent commits of a given commit hash.
	FetchParentCommits(context.Context, string) (Commits, error)
}

Repo is the abstraction for a remote repository.

type Tag

type Tag struct {
	Name   string
	Time   time.Time
	Commit Commit
	WebURL string
}

Tag represents a tag.

func (Tag) After

func (t Tag) After(u Tag) bool

After determines if a given tag is chronologically after another tag. Two tags are compared using the commits they refer to.

func (Tag) Before

func (t Tag) Before(u Tag) bool

Before determines if a given tag is chronologically before another tag. Two tags are compared using the commits they refer to.

func (Tag) Equal

func (t Tag) Equal(u Tag) bool

Equal determines if two tags are the same. Two tags are the same if they both have the same name.

func (Tag) IsZero

func (t Tag) IsZero() bool

IsZero determines if a tag is a zero tag instance.

func (Tag) String

func (t Tag) String() string

type Tags

type Tags []Tag

Tags is a collection of tags.

func (Tags) Exclude

func (t Tags) Exclude(names ...string) Tags

Exclude excludes the given tag names and returns a new list of tags.

func (Tags) ExcludeRegex

func (t Tags) ExcludeRegex(regex *regexp.Regexp) Tags

ExcludeRegex excludes matched tags against the given regex and returns a new list of tags.

func (Tags) Find

func (t Tags) Find(name string) (Tag, bool)

Find looks up a tag by its name.

func (Tags) First

func (t Tags) First(f func(Tag) bool) (Tag, bool)

First returns the first tag that satisifies the given predicate. If you pass a nil function, the first tag will be returned.

func (Tags) Index

func (t Tags) Index(name string) int

Index looks up a tag by its name and returns its index if found. Index returns the index of a tag specified by its name, or -1 if not found.

func (Tags) Last

func (t Tags) Last(f func(Tag) bool) (Tag, bool)

Last returns the last tag that satisifies the given predicate. If you pass a nil function, the last tag will be returned.

func (Tags) Map

func (t Tags) Map(f func(t Tag) string) []string

Map converts a list of tags to a list of strings.

func (Tags) Select

func (t Tags) Select(f func(Tag) bool) (Tags, Tags)

Select returns a new list of tags that satisfies the predicate f.

func (Tags) Sort

func (t Tags) Sort() Tags

Sort sorts the collection of tags by their times from the most recent to the least recent.

type User

type User struct {
	Name     string
	Email    string
	Username string
	WebURL   string
}

User represents a user.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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