models

package
v12.2.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2018 License: MIT Imports: 9 Imported by: 11

Documentation

Index

Constants

This section is empty.

Variables

AllModels contains all the tables contained in butler's database

Functions

func CollectionByID

func CollectionByID(db *gorm.DB, id int64) *itchio.Collection

func CollectionExt

func CollectionExt(c *itchio.Collection) collectionExt

func DownloadMaxPosition

func DownloadMaxPosition(db *gorm.DB) int64

func DownloadMinPosition

func DownloadMinPosition(db *gorm.DB) int64

func GameByID

func GameByID(db *gorm.DB, id int64) *itchio.Game

func HadesContext

func HadesContext(db *gorm.DB) *hades.Context

func MarshalVerdict

func MarshalVerdict(in *configurator.Verdict, out *JSON) error

func MustPreload

func MustPreload(db *gorm.DB, params *hades.PreloadParams) error

func MustPreloadSimple

func MustPreloadSimple(db *gorm.DB, record interface{}, fields ...string)

func Preload

func Preload(db *gorm.DB, params *hades.PreloadParams) error

func PreloadCaves

func PreloadCaves(db *gorm.DB, caveOrCaves interface{})

func PreloadDownloads

func PreloadDownloads(db *gorm.DB, downloadOrDownloads interface{})

func PreloadSimple

func PreloadSimple(db *gorm.DB, record interface{}, fields ...string) error

func UnmarshalVerdict

func UnmarshalVerdict(in JSON) (*configurator.Verdict, error)

Types

type Cave

type Cave struct {
	ID string `json:"id"`

	GameID int64        `json:"gameId"`
	Game   *itchio.Game `json:"game"`

	ExternalGameID int64 `json:"externalGameId"`

	UploadID int64          `json:"uploadId"`
	Upload   *itchio.Upload `json:"upload"`
	BuildID  int64          `json:"buildId"`
	Build    *itchio.Build  `json:"build"`

	Morphing bool `json:"morphing"`

	InstalledAt   *time.Time `json:"installedAt"`
	LastTouchedAt *time.Time `json:"lastTouchedAt"`
	SecondsRun    int64      `json:"secondsRun"`

	Verdict       JSON  `json:"verdict"`
	InstalledSize int64 `json:"installedSize"`

	InstallLocationID string           `json:"installLocationId"`
	InstallLocation   *InstallLocation `json:"installLocation"`

	InstallFolderName string `json:"installFolderName"`

	// If set, InstallLocationID is empty and this is used
	// for all operations instead
	CustomInstallFolder string `json:"customInstallFolder"`
}

func CaveByID

func CaveByID(db *gorm.DB, id string) *Cave

func CavesByGameID

func CavesByGameID(db *gorm.DB, gameID int64) []*Cave

func (*Cave) GetInstallFolder

func (c *Cave) GetInstallFolder(db *gorm.DB) string

func (*Cave) GetInstallLocation

func (c *Cave) GetInstallLocation(db *gorm.DB) *InstallLocation

func (*Cave) GetVerdict

func (c *Cave) GetVerdict() *configurator.Verdict

func (*Cave) Preload

func (c *Cave) Preload(db *gorm.DB)

func (*Cave) RecordPlayTime

func (c *Cave) RecordPlayTime(playTime time.Duration)

func (*Cave) Save

func (c *Cave) Save(db *gorm.DB)

func (*Cave) SetVerdict

func (c *Cave) SetVerdict(verdict *configurator.Verdict)

func (*Cave) Touch

func (c *Cave) Touch()

func (*Cave) UpdateInstallTime

func (c *Cave) UpdateInstallTime()

type Download

type Download struct {
	// An UUID
	ID string `json:"id" gorm:"primary_key"`

	Reason     string     `json:"reason"`
	Position   int64      `json:"position"`
	StartedAt  *time.Time `json:"startedAt"`
	FinishedAt *time.Time `json:"finishedAt"`

	Error *string `json:"error"`

	CaveID string `json:"caveId"`

	GameID int64        `json:"gameId"`
	Game   *itchio.Game `json:"game"`

	UploadID int64          `json:"uploadId"`
	Upload   *itchio.Upload `json:"upload"`

	BuildID int64         `json:"buildId"`
	Build   *itchio.Build `json:"build"`

	StagingFolder string `json:"stagingFolder"`
	InstallFolder string `json:"installFolder"`

	Discarded bool `json:"discarded"`
	Fresh     bool `json:"fresh"`
}

func AllDownloads

func AllDownloads(db *gorm.DB) []*Download

func DownloadByID

func DownloadByID(db *gorm.DB, downloadID string) *Download

func (*Download) Preload

func (d *Download) Preload(db *gorm.DB)

func (*Download) Save

func (d *Download) Save(db *gorm.DB)

type DownloadKey

type DownloadKey struct {
	ID int64 `json:"id"`

	GameID int64        `json:"gameId"`
	Game   *itchio.Game `json:"game,omitempty"`

	CreatedAt string `json:"createdAt"`
	UpdatedAt string `json:"updatedAt"`

	OwnerID int64        `json:"ownerId"`
	Owner   *itchio.User `json:"owner,omitempty"`
}

func DownloadKeysByGameID

func DownloadKeysByGameID(db *gorm.DB, gameID int64) []*DownloadKey

type InstallLocation

type InstallLocation struct {
	ID string `json:"id" gorm:"primary_key"`

	Path string `json:"path"`

	Caves []*Cave `json:"caves"`
}

func InstallLocationByID

func InstallLocationByID(db *gorm.DB, id string) *InstallLocation

func (*InstallLocation) GetCaves

func (il *InstallLocation) GetCaves(db *gorm.DB) []*Cave

func (*InstallLocation) GetInstallFolder

func (il *InstallLocation) GetInstallFolder(folderName string) string

func (*InstallLocation) GetStagingFolder

func (il *InstallLocation) GetStagingFolder(installID string) string

type JSON

type JSON string

type Profile

type Profile struct {
	ID int64 `json:"id"`

	APIKey string `json:"apiKey"`

	LastConnected time.Time    `json:"lastConnected"`
	User          *itchio.User `json:"user"`
	UserID        int64        `json:"userId"`

	Developer bool `json:"developer"`
	PressUser bool `json:"pressUser"`

	ProfileCollections []*ProfileCollection  `json:"profileCollections,omitempty"`
	ProfileGames       []*ProfileGame        `json:"profileGames,omitempty"`
	OwnedKeys          []*itchio.DownloadKey `json:"ownedKeys,omitempty" gorm:"foreignKey:owner_id"`
}

func AllProfiles

func AllProfiles(db *gorm.DB) []*Profile

func ProfileByID

func ProfileByID(db *gorm.DB, id int64) *Profile

func (*Profile) UpdateFromUser

func (p *Profile) UpdateFromUser(user *itchio.User)

type ProfileCollection

type ProfileCollection struct {
	CollectionID int64 `gorm:"primary_key;auto_increment:false"`
	Collection   *itchio.Collection

	ProfileID int64 `gorm:"primary_key;auto_increment:false"`
	Profile   *Profile

	Position int64
}

type ProfileData

type ProfileData struct {
	ProfileID int64  `json:"profileId" gorm:"primary_key;auto_increment:false"`
	Key       string `json:"string" gorm:"primary_key"`
	Value     string `json:'string"`
}

type ProfileGame

type ProfileGame struct {
	GameID int64        `json:"gameId" gorm:"primary_key;auto_increment:false"`
	Game   *itchio.Game `json:"game,omitempty"`

	// ID of the profile this game is associated with - they're
	// not necessarily the original owner, they just have admin
	// access to it.
	ProfileID int64    `json:"profileId" gorm:"primary_key;auto_increment:false"`
	Profile   *Profile `json:"profile,omitempty"`

	Position int64 `json:"position"`

	ViewsCount     int64 `json:"viewsCount"`
	DownloadsCount int64 `json:"downloadsCount"`
	PurchasesCount int64 `json:"purchasesCount"`

	Published bool `json:"published"`
}

Join table for Profile <has many> Games

func ProfileGamesByGameID

func ProfileGamesByGameID(db *gorm.DB, gameID int64) []*ProfileGame

Jump to

Keyboard shortcuts

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