updater

package
v1.5.4 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2023 License: LGPL-3.0 Imports: 5 Imported by: 21

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) 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. 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

Jump to

Keyboard shortcuts

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