Documentation ¶
Overview ¶
Package uptd provides an interface and implementation for checking if there's a newer version available in a remote artifact repository.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CheckResponse ¶
type CheckResponse struct { NeedsUpdate bool Current semver.Version Latest LatestResponse }
CheckResponse is given back by the Check method of an updater.
type GetLatestFunc ¶
type GetLatestFunc func(ctx context.Context, owner, repo string) (*github.RepositoryRelease, *github.Response, error)
GetLatestFunc is used by the GithubProvider to discover newer releases
type GithubProvider ¶
type GithubProvider struct {
// contains filtered or unexported fields
}
GithubProvider is the implementation of an update Provider that is used by the Updater struct
func NewGithubProvider ¶
func NewGithubProvider(owner, repo, token string) (*GithubProvider, error)
NewGithubProvider constructs a new GithubProvider from its parameters.
func (*GithubProvider) Latest ¶
func (u *GithubProvider) Latest() (LatestResponse, error)
Latest queries the remote Github repository to check for a newer version of the executable available.
type LatestResponse ¶
LatestResponse is given back by the Latest method of an update Provider.
type Provider ¶
type Provider interface { // Latest queries the remote provider to check for a newer version of the // executable available in the remote artifact repository. Latest() (LatestResponse, error) }
Provider represents the remote artifact repository where the updater checks if there's a newer version.
type Uptd ¶
type Uptd struct {
// contains filtered or unexported fields
}
Uptd checks if the current version is the latest one and thus up to date.
func New ¶
New instantiates a new Uptd from the sent Provider and current version. If the version is not semver compatible an error will be returned.
func (Uptd) Check ¶
func (u Uptd) Check() (CheckResponse, error)
Check checks if there's a newer release available in the remote and returns a response that instructs whether or not the client should download the newer version if any is available.