Documentation
¶
Index ¶
- Constants
- Variables
- func CollectionByID(conn *sqlite.Conn, id int64) *itchio.Collection
- func CollectionExt(c *itchio.Collection) collectionExt
- func ColumnTime(col int, stmt *sqlite.Stmt) *time.Time
- func Count(conn *sqlite.Conn, model interface{}, cond builder.Cond) (int64, error)
- func Delete(conn *sqlite.Conn, model interface{}, cond builder.Cond) error
- func DiscardDownloadsByCaveID(conn *sqlite.Conn, caveID string)
- func DownloadKeysByGameID(conn *sqlite.Conn, gameID int64) []*itchio.DownloadKey
- func DownloadMaxPosition(conn *sqlite.Conn) int64
- func DownloadMinPosition(conn *sqlite.Conn) int64
- func Exec(conn *sqlite.Conn, b *builder.Builder, resultFn hades.ResultFn) error
- func ExecRaw(conn *sqlite.Conn, query string, resultFn hades.ResultFn, args ...interface{}) error
- func ExecWithSearch(conn *sqlite.Conn, b *builder.Builder, search hades.Search, ...) error
- func GameByID(conn *sqlite.Conn, id int64) *itchio.Game
- func GetSchemaVersion(conn *sqlite.Conn) int64
- func HadesContext() *hades.Context
- func MarkAllFresh(conn *sqlite.Conn, fts []FetchTarget) error
- func MarshalVerdict(in *dash.Verdict, out *JSON) error
- func Must(err error)
- func MustCount(conn *sqlite.Conn, model interface{}, cond builder.Cond) int64
- func MustDelete(conn *sqlite.Conn, model interface{}, cond builder.Cond)
- func MustExec(conn *sqlite.Conn, b *builder.Builder, resultFn hades.ResultFn)
- func MustExecRaw(conn *sqlite.Conn, query string, resultFn hades.ResultFn, args ...interface{})
- func MustExecWithSearch(conn *sqlite.Conn, b *builder.Builder, search hades.Search, ...)
- func MustMarkAllFresh(conn *sqlite.Conn, fts []FetchTarget)
- func MustPreload(conn *sqlite.Conn, record interface{}, opts ...hades.PreloadParam)
- func MustPreloadGameSales(conn *sqlite.Conn, g *itchio.Game)
- func MustPreloadGamesSales(conn *sqlite.Conn, games []*itchio.Game)
- func MustSave(conn *sqlite.Conn, record interface{}, opts ...hades.SaveParam)
- func MustSelect(conn *sqlite.Conn, result interface{}, cond builder.Cond, search hades.Search)
- func MustSelectOne(conn *sqlite.Conn, result interface{}, cond builder.Cond) bool
- func MustUpdate(conn *sqlite.Conn, model interface{}, where hades.WhereCond, ...)
- func Preload(conn *sqlite.Conn, record interface{}, opts ...hades.PreloadParam) error
- func PreloadCaves(conn *sqlite.Conn, caveOrCaves interface{})
- func PreloadDownloads(conn *sqlite.Conn, downloadOrDownloads interface{})
- func Save(conn *sqlite.Conn, record interface{}, opts ...hades.SaveParam) error
- func Select(conn *sqlite.Conn, result interface{}, cond builder.Cond, search hades.Search) error
- func SelectOne(conn *sqlite.Conn, result interface{}, cond builder.Cond) (bool, error)
- func SetSchemaVersion(conn *sqlite.Conn, version int64)
- func UnmarshalVerdict(in JSON) (*dash.Verdict, error)
- func Update(conn *sqlite.Conn, model interface{}, where hades.WhereCond, ...) error
- func UserByID(conn *sqlite.Conn, id int64) *itchio.User
- type Cave
- func (c *Cave) Delete(conn *sqlite.Conn)
- func (c *Cave) GetInstallFolder(conn *sqlite.Conn) string
- func (c *Cave) GetInstallLocation(conn *sqlite.Conn) *InstallLocation
- func (c *Cave) GetVerdict() *dash.Verdict
- func (c *Cave) Preload(conn *sqlite.Conn)
- func (c *Cave) RecordPlayTime(playTime time.Duration)
- func (c *Cave) Save(conn *sqlite.Conn)
- func (c *Cave) SaveWithAssocs(conn *sqlite.Conn)
- func (c *Cave) SetVerdict(verdict *dash.Verdict)
- func (c *Cave) Touch()
- func (c *Cave) UpdateInstallTime()
- func (c *Cave) UpdateInteractions(summary *itchio.UserGameInteractionsSummary)
- type CaveHistoricalPlayTime
- type Download
- type FetchInfo
- type FetchTarget
- func FetchTargetForCollection(collectionID int64) FetchTarget
- func FetchTargetForCollectionGames(collectionID int64) FetchTarget
- func FetchTargetForGame(gameID int64) FetchTarget
- func FetchTargetForGameUploads(gameID int64) FetchTarget
- func FetchTargetForProfileCollections(profileID int64) FetchTarget
- func FetchTargetForProfileGames(profileID int64) FetchTarget
- func FetchTargetForProfileOwnedKeys(profileID int64) FetchTarget
- func FetchTargetForUpload(uploadID int64) FetchTarget
- func FetchTargetForUser(userID int64) FetchTarget
- func (ft FetchTarget) GetInfo(conn *sqlite.Conn) (*FetchInfo, error)
- func (ft FetchTarget) IsStale(conn *sqlite.Conn) (bool, error)
- func (ft FetchTarget) Key() string
- func (ft FetchTarget) MarkFresh(conn *sqlite.Conn) error
- func (ft FetchTarget) MustGetInfo(conn *sqlite.Conn) *FetchInfo
- func (ft FetchTarget) MustIsStale(conn *sqlite.Conn) bool
- func (ft FetchTarget) MustMarkFresh(conn *sqlite.Conn)
- func (ft FetchTarget) Validate() error
- type GameUpload
- type InstallLocation
- type JSON
- type Profile
- type ProfileCollection
- type ProfileData
- type ProfileGame
- type SchemaVersion
Constants ¶
View Source
const SchemaVersionID = "database"
Variables ¶
View Source
var AllModels = []interface{}{ &SchemaVersion{}, &Profile{}, &ProfileCollection{}, &itchio.DownloadKey{}, &itchio.Collection{}, &itchio.CollectionGame{}, &ProfileGame{}, &itchio.Game{}, &itchio.User{}, &Download{}, &Cave{}, &itchio.GameEmbedData{}, &itchio.Sale{}, &InstallLocation{}, &itchio.Upload{}, &itchio.Build{}, &ProfileData{}, &FetchInfo{}, &GameUpload{}, &CaveHistoricalPlayTime{}, }
AllModels contains all the tables contained in butler's database
Functions ¶
func CollectionByID ¶
func CollectionByID(conn *sqlite.Conn, id int64) *itchio.Collection
func CollectionExt ¶
func CollectionExt(c *itchio.Collection) collectionExt
func DownloadKeysByGameID ¶
func DownloadKeysByGameID(conn *sqlite.Conn, gameID int64) []*itchio.DownloadKey
func DownloadMaxPosition ¶
func DownloadMinPosition ¶
func ExecWithSearch ¶
func GetSchemaVersion ¶
func HadesContext ¶
func MarkAllFresh ¶
func MarkAllFresh(conn *sqlite.Conn, fts []FetchTarget) error
func MustExecRaw ¶
func MustExecWithSearch ¶
func MustMarkAllFresh ¶
func MustMarkAllFresh(conn *sqlite.Conn, fts []FetchTarget)
func MustPreload ¶
func MustPreload(conn *sqlite.Conn, record interface{}, opts ...hades.PreloadParam)
func MustSelect ¶
func MustSelectOne ¶
func MustUpdate ¶
func Preload ¶
func Preload(conn *sqlite.Conn, record interface{}, opts ...hades.PreloadParam) error
func PreloadCaves ¶
func PreloadDownloads ¶
func SetSchemaVersion ¶
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"`
Pinned bool `json:"pinned"`
InstalledAt *time.Time `json:"installedAt"`
LastTouchedAt *time.Time `json:"lastTouchedAt"`
SecondsRun int64 `json:"secondsRun"`
SnoozedAt *time.Time `json:"snoozedAt"`
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 (*Cave) GetInstallLocation ¶
func (c *Cave) GetInstallLocation(conn *sqlite.Conn) *InstallLocation
func (*Cave) GetVerdict ¶
func (*Cave) RecordPlayTime ¶
func (*Cave) SaveWithAssocs ¶
func (*Cave) SetVerdict ¶
func (*Cave) UpdateInstallTime ¶
func (c *Cave) UpdateInstallTime()
func (*Cave) UpdateInteractions ¶
func (c *Cave) UpdateInteractions(summary *itchio.UserGameInteractionsSummary)
type CaveHistoricalPlayTime ¶
type CaveHistoricalPlayTime struct {
CaveID string `hades:"primary_key"`
GameID int64
UploadID int64
BuildID int64
SecondsRun int64
LastTouchedAt *time.Time
CreatedAt *time.Time
UploadedAt *time.Time
}
func CaveHistoricalPlayTimeForCaves ¶
func CaveHistoricalPlayTimeForCaves(conn *sqlite.Conn, caves []*Cave) []*CaveHistoricalPlayTime
func (*CaveHistoricalPlayTime) MarkUploaded ¶
func (chpt *CaveHistoricalPlayTime) MarkUploaded(conn *sqlite.Conn)
type Download ¶
type Download struct {
// An UUID
ID string `json:"id" hades:"primary_key"`
Reason string `json:"reason"`
Position int64 `json:"position"`
StartedAt *time.Time `json:"startedAt"`
FinishedAt *time.Time `json:"finishedAt"`
// Full error, complete with stack trace etc.
Error *string `json:"error"`
// Standard butlerd error code
ErrorCode *int64 `json:"errorCode"`
// Short error message (hopefully human-readable)
ErrorMessage *string `json:"errorMessage"`
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"`
InstallLocationID string `json:"installLocationId"`
Discarded bool `json:"discarded"`
Fresh bool `json:"fresh"`
}
func AllDownloads ¶
type FetchInfo ¶
type FetchInfo struct {
// Something like "profile", "profile_collections", etc.
ObjectType string `hades:"primary_key"`
ObjectID string `hades:"primary_key"`
FetchedAt *time.Time
}
func GetFetchInfo ¶
type FetchTarget ¶
type FetchTarget struct {
// snake_case, like "profile_collections", "collection", "collection_games", etc.
Type string
// if non-empty, will be used
StringID string
// if StringID is empty, this is used
ID int64
// age after which a resource is considered stale
TTL time.Duration
}
func FetchTargetForCollection ¶
func FetchTargetForCollection(collectionID int64) FetchTarget
func FetchTargetForCollectionGames ¶
func FetchTargetForCollectionGames(collectionID int64) FetchTarget
func FetchTargetForGame ¶
func FetchTargetForGame(gameID int64) FetchTarget
func FetchTargetForGameUploads ¶
func FetchTargetForGameUploads(gameID int64) FetchTarget
func FetchTargetForProfileCollections ¶
func FetchTargetForProfileCollections(profileID int64) FetchTarget
func FetchTargetForProfileGames ¶
func FetchTargetForProfileGames(profileID int64) FetchTarget
func FetchTargetForProfileOwnedKeys ¶
func FetchTargetForProfileOwnedKeys(profileID int64) FetchTarget
func FetchTargetForUpload ¶
func FetchTargetForUpload(uploadID int64) FetchTarget
func FetchTargetForUser ¶
func FetchTargetForUser(userID int64) FetchTarget
func (FetchTarget) Key ¶
func (ft FetchTarget) Key() string
func (FetchTarget) MustGetInfo ¶
func (ft FetchTarget) MustGetInfo(conn *sqlite.Conn) *FetchInfo
func (FetchTarget) MustIsStale ¶
func (ft FetchTarget) MustIsStale(conn *sqlite.Conn) bool
func (FetchTarget) MustMarkFresh ¶
func (ft FetchTarget) MustMarkFresh(conn *sqlite.Conn)
func (FetchTarget) Validate ¶
func (ft FetchTarget) Validate() error
type GameUpload ¶
type InstallLocation ¶
type InstallLocation struct {
ID string `json:"id" hades:"primary_key"`
Path string `json:"path"`
Caves []*Cave `json:"caves"`
}
func InstallLocationByID ¶
func InstallLocationByID(conn *sqlite.Conn, id string) *InstallLocation
func (*InstallLocation) GetInstallFolder ¶
func (il *InstallLocation) GetInstallFolder(folderName string) string
func (*InstallLocation) GetStagingFolder ¶
func (il *InstallLocation) GetStagingFolder(installID string) 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" hades:"foreign_key:owner_id"`
}
func AllProfiles ¶
func (*Profile) UpdateFromUser ¶
type ProfileCollection ¶
type ProfileData ¶
type ProfileGame ¶
type ProfileGame struct {
GameID int64 `json:"gameId" hades:"primary_key"`
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" hades:"primary_key"`
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(conn *sqlite.Conn, gameID int64) []*ProfileGame
type SchemaVersion ¶
Source Files
¶
Click to show internal directories.
Click to hide internal directories.