Documentation
¶
Index ¶
Constants ¶
const (
VersionString string = "1.0.3"
)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ComparisonResult ¶ added in v1.0.3
type ComparisonResult int
ComparisonResult represents the result of comparing two values.
const ( // LessThan indicates that the first value is less than the second in a comparison operation. LessThan ComparisonResult = iota // Equal indicates that the first value is equal to the second in a comparison operation. Equal // GreaterThan indicates that the first value is greater than the second in a comparison operation. GreaterThan )
type GitHubClient ¶ added in v0.10.0
type GitHubClient interface {
QueryLatestReleaseTag(ctx context.Context) (*GithubRelease, error)
}
GitHubClient is an interface for interacting with GitHub's API, specifically for querying the latest release tag of a repository.
func NewGitHubApiClient ¶
func NewGitHubApiClient(httpClient HttpClient, config ...HttpClientOptionsFunc) GitHubClient
NewGitHubApiClient creates a new GitHubClient with customizable HTTP client options for querying GitHub's API.
type GithubRelease ¶
type GithubRelease struct {
Id uint64 `json:"id"`
TagName string `json:"tag_name"`
Name string `json:"name"`
HtmlUrl string `json:"html_url"`
PublishedAt time.Time `json:"published_at"`
}
GithubRelease represents a release from a GitHub repository, including essential metadata and URL for access.
func (GithubRelease) TryParseVersionFromTag ¶
func (r GithubRelease) TryParseVersionFromTag() (*VersionInfo, error)
TryParseVersionFromTag attempts to extract and parse semantic version details from the TagName of a GitHub release.
type HttpClient ¶ added in v0.10.0
HttpClient provides an interface for making HTTP requests, allowing for different implementations such as mocks or wrappers.
type HttpClientOptions ¶
HttpClientOptions holds configuration options for customizing the behavior of an HttpClient.
type HttpClientOptionsFunc ¶
type HttpClientOptionsFunc func(*HttpClientOptions)
HttpClientOptionsFunc represents a function that modifies HttpClientOptions to customize HttpClient's behavior.
type VersionInfo ¶
VersionInfo represents the version details using semantic versioning.
func ApplicationVersion ¶
func ApplicationVersion() (*VersionInfo, error)
ApplicationVersion parses and returns the application's version information. If the version is not set, an error is returned.
func (VersionInfo) Compare ¶ added in v1.0.3
func (v VersionInfo) Compare(other VersionInfo) ComparisonResult
Compare compares the current VersionInfo instance with another VersionInfo instance and returns a ComparisonResult.
func (VersionInfo) Equal ¶
func (v VersionInfo) Equal(other VersionInfo) bool
Equal determines if two VersionInfo instances represent the same version based on semantic versioning.
func (VersionInfo) LessThan ¶
func (v VersionInfo) LessThan(other VersionInfo) bool
LessThan determines if the current VersionInfo is less than the specified VersionInfo based on semantic versioning.
func (VersionInfo) LessThanOrEqual ¶ added in v1.0.3
func (v VersionInfo) LessThanOrEqual(other VersionInfo) bool
LessThanOrEqual determines if the current VersionInfo is less than or equal to the specified VersionInfo based on semantic versioning.
func (VersionInfo) String ¶
func (v VersionInfo) String() string
String returns the VersionInfo as a formatted string in the semantic versioning format (Major.Minor.Patch).