updater

package
v1.5.1 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2021 License: LGPL-3.0 Imports: 5 Imported by: 22

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type UpdateHook added in v1.5.1

type UpdateHook interface {
	// PostUpdate is called after a successful update
	// if error is not nil, then Updater.Rollback will be called
	PostUpdate(u *Updater) error
}

UpdateHook is an interface you can implement and pass to the Updater to be called depending on the situation

type UpdateStatus added in v1.5.0

type UpdateStatus int

UpdateStatus represents the status after Updater{}.Update() was called

const (
	// Unknown update status (something went wrong)
	Unknown UpdateStatus = iota
	// UpToDate means the software is already up to date
	UpToDate
	// Updated means the software have been updated
	Updated
)

type Updater

type Updater struct {
	Provider           provider.Provider
	ExecutableName     string     // Name of the executable
	Version            string     // The current version of your program
	OverrideExecutable string     // (optional) Overrides the path of the executable
	Hook               UpdateHook // (optional) Set the update hooks (see interface documentation)
	// contains filtered or unexported fields
}

Updater struct

func (*Updater) CanUpdate

func (u *Updater) CanUpdate() (bool, error)

CanUpdate checks if the updater found a new version

func (*Updater) GetExecutable added in v1.5.0

func (u *Updater) GetExecutable() (string, error)

GetExecutable gets the executable path that will be used to for the update process same as fileio.GetExecutable() but this one takes into account the variable OverrideExecutablePath

func (*Updater) GetLatestVersion added in v1.5.0

func (u *Updater) GetLatestVersion() (string, error)

GetLatestVersion gets the latest version (same as provider.GetLatestVersion but keeps the version in cache)

func (*Updater) Rollback added in v1.5.0

func (u *Updater) Rollback() (err error)

Rollback rollbacks to the previous version Use this if you know what you are doing

func (*Updater) Update added in v1.0.0

func (u *Updater) Update() (status UpdateStatus, err error)

Update runs the updater It will update the current application if an update is found

Jump to

Keyboard shortcuts

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