Documentation ¶
Index ¶
- Constants
- Variables
- func CollectSequence[T interface{}](it Sequence[T]) ([]*T, error)
- func ConsumeSequence[T interface{}](it Sequence[T], consume func(*T) error) error
- func GetGithubClient() *github.Client
- func ReverseSlice[S ~[]E, E any](s S)
- func WithTempGitRemote(git GitHelper, remote, url string, f func() error) error
- func WithTempLocalBranch(git GitHelper, localBranch, remote, remoteBranch string, ...) error
- type GitHelper
- type GithubClientListFunc
- type Sequence
Constants ¶
const ( ProjectName = "synchro" PackageName = "github.com/jasondellaluce/" + ProjectName ProjectRepo = "https://" + PackageName ProjectDescription = "Next-gen tooling for keeping in sync private forks of open source repositories" )
Variables ¶
var ErrSeqBreakout = errors.New("sequence iteration breakout")
ErrSeqBreakout represents the intentional breakout from a sequence iteration operation.
var (
ProjectVersion = "0.0.0"
)
Functions ¶
func CollectSequence ¶
CollectSequence takes a sequence and iterates over all its elements up until all are consumed, collecting them in a slice. Returns a non-nil error in case of failure, and nil otherwise.
func ConsumeSequence ¶
ConsumeSequence takes a sequence and iterates over all its elements up until all are consumed, and invokes a consumption callbacks on them. If the consumer function returns a non-nil error, the iterations stops and th error is returned. Returns a non-nil error in case of failure, and nil otherwise.
func GetGithubClient ¶
func ReverseSlice ¶
func ReverseSlice[S ~[]E, E any](s S)
func WithTempGitRemote ¶
Types ¶
type GitHelper ¶
type GitHelper interface { // Essentials // Pull(remote, branch string) // Push(remote, branch string) // Reset() // ResetHard() // Add(file string) // AddAll() // Commit(msg string) // Checkout(branch string) // CheckoutRemote(branch string, remoteBranch string) // AddRemote(remote string) // RemoveRemote(remote string) // FetchRemote(remote string) // FetchPrune(remote string) // CherryPick(commit string) // CherryPickContinue() // CherryPickAbort() // DeleteBranch() string Do(commands ...string) error DoOutput(commands ...string) (string, error) HasLocalChanges(filters ...func(string) bool) (bool, error) ListUnmergedFiles() ([]string, error) GetCurrentBranch() (string, error) GetRemoteDefaultBranch(remote string) (string, error) BranchExistsInRemote(remote, branch string) (bool, error) GetRepoRootDir() (string, error) GetRemotes() (map[string]string, error) TagExists(tag string) (bool, error) }
func NewGitHelper ¶
func NewGitHelper() GitHelper
type GithubClientListFunc ¶
type GithubClientListFunc[T interface{}] func(*github.ListOptions) ([]*T, *github.Response, error)
GithubClientListFunc is a generic functional wrapper for "list"-type API invocations of a GitHub client for which the list options are provided.
type Sequence ¶
type Sequence[T interface{}] interface { // // Next returns the next element in the iterator, or nil in case the // sequence has no more elements. Next() *T // // Returns a non-nil error in case of failures when creating or using // the iterator, or nil otherwise. Error() error }
Sequence represents an iterator for sequences that can be used for loop over all the elements available one by one in a stateful manner, up until the sequence is completely consumed.
func NewFilteredSequence ¶
NewFilteredSequence returns a new sequence that filters the elements of another sequence with a filtering function. The new sequence contains all elements for which the filtering function returns true.
func NewGithubSequence ¶
func NewGithubSequence[T interface{}](f GithubClientListFunc[T]) Sequence[T]
NewGithubSequence creates a new sequence starting from a GithubClientListFunc