Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ReleaseInfo ¶
type ReleaseInfo struct {
Version semver.Version `json:"version"`
Channel UpdateChannel `json:"channel"`
AssetURL string `json:"asset_url"`
Signature string `json:"signature"`
Checksum string `json:"checksum"`
ReleaseNotes string `json:"release_notes"`
}
ReleaseInfo contains information about a release
type RestartInfo ¶
type RestartInfo struct {
Args []string `json:"args"`
Environment []string `json:"environment"`
WorkingDir string `json:"working_dir"`
Timestamp time.Time `json:"timestamp"`
}
RestartInfo contains information about the command to restart after update
type TelemetryData ¶
type TelemetryData struct {
Timestamp time.Time `json:"timestamp"`
Success bool `json:"success"`
FromVersion string `json:"from_version"`
ToVersion string `json:"to_version"`
Channel UpdateChannel `json:"channel"`
ErrorMessage string `json:"error_message,omitempty"`
}
TelemetryData represents update telemetry information
type UpdateCache ¶
type UpdateCache struct {
LastCheck time.Time `json:"last_check"`
LatestVersion string `json:"latest_version"`
Channel UpdateChannel `json:"channel"`
TTL time.Duration `json:"ttl"`
}
UpdateCache stores information about the last update check
type UpdateChannel ¶
type UpdateChannel string
UpdateChannel represents the release channel type
const ( StableChannel UpdateChannel = "stable" BetaChannel UpdateChannel = "beta" )
type Updater ¶
type Updater struct {
CurrentVersion string
GithubRepo string
CacheFile string
PublicKey ed25519.PublicKey
Channel UpdateChannel
TelemetryPath string
RestartPath string
// contains filtered or unexported fields
}
Updater handles the auto-update functionality
func New ¶
func New(currentVersion, githubRepo string, channel UpdateChannel) (*Updater, error)
New creates a new Updater instance
func (*Updater) Check ¶
func (u *Updater) Check() (*ReleaseInfo, error)
Check looks for available updates
func (*Updater) GetChangelog ¶
func (u *Updater) GetChangelog(release *ReleaseInfo) string
GetChangelog retrieves the changelog for the release
func (*Updater) RestartAfterUpdate ¶
RestartAfterUpdate restarts the previously running command
func (*Updater) SaveRestartInfo ¶
SaveRestartInfo saves the current command information for restart after update
func (*Updater) Update ¶
func (u *Updater) Update(release *ReleaseInfo) error
Update performs the actual update
Click to show internal directories.
Click to hide internal directories.