versions

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2022 License: Unlicense Imports: 11 Imported by: 0

Documentation

Overview

Keeps track of the versions of mods installed using SWkshp.

Each mod folder has its own ".swkshp.db" database

Index

Constants

View Source
const DBName string = ".swkshp.db"

Variables

This section is empty.

Functions

func CheckForUpdate added in v1.2.1

func CheckForUpdate(games ...string) (map[string]map[*resource.Resource]bool, []error)

The map maps the game strings to a map mapping IDs to bools, where the boolean represents whether an update is available.

func DBCloseAll added in v1.2.0

func DBCloseAll() (errs []error)

func DBLen added in v1.2.0

func DBLen() int

func DBOpen added in v1.2.0

func DBOpen(game string) (*sql.DB, error)

func GetDBPath

func GetDBPath(game string, create ...bool) (string, error)

Gets the path to the sqlite3 database. If true is given as the second argument, it will create one if it doesn't exist.

func RemoveModEntry

func RemoveModEntry(game string, id int) (sql.Result, error)

Deletes the mod database entry for a given game/mod id combination.

func UpdateModEntry

func UpdateModEntry(game string, entry Entry) (sql.Result, error)

Either creates an entry for the given mod ID if one doesn't already exist. Otherwise, updates the existing entry.

Types

type Entry

type Entry struct {
	ID      int64     `db:"id"`      // Workshop ID.
	Path    string    `db:"path"`    // Relative path from game mod directory as given by config
	Sum     []byte    `db:"sum"`     // 16 byte MD5 checksum.
	Updated time.Time `db:"updated"` // Timestamp of the last time it was changed.
}

func Compare

func Compare(a, b *Entry) (*Entry, bool)

Returns the newest entry of the two and a boolean of whether or not the checksum is the same (true means it is)

func GetAllEntries added in v1.2.1

func GetAllEntries(game string) ([]Entry, error)

Gets all entries in the mods database for a given game.

func GetModEntry

func GetModEntry(game string, id int) (*Entry, error)

Gets the mod database entry for a given game/mod id combination.

func NewModEntry

func NewModEntry(workshopID int, zippedModPath string) (Entry, error)

workshopID: The Steam Workshop ID of the mod.

zippedModPath: The local path to the mod as zipped by Steam.

Jump to

Keyboard shortcuts

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