Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PostUpdateFunc ¶ added in v1.5.2
type PostUpdateFunc func(u *Updater) (UpdateStatus, error)
PostUpdateFunc is called after a successful update On error you can/should call u.Rollback() yourself
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 PostUpdateFunc PostUpdateFunc // (optional) Set a function that will be called after an update (see type documentation) // contains filtered or unexported fields }
Updater struct
func (*Updater) GetExecutable ¶ added in v1.5.0
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
GetLatestVersion gets the latest version (same as provider.GetLatestVersion but keeps the version in cache)
func (*Updater) Rollback ¶ added in v1.5.0
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. If the application is up-to-date then no error will be returned. YOU DON'T NEED TO call Rollback() yourself! UNLESS you want to rollback after a successful update