database

package
v2.6.0-beta8 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2025 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Database

type Database struct {
	UserDB  UserDBI
	MediaDB MediaDBI
}

Database is a portable interface for ENV bindings

type FileInfo

type FileInfo struct {
	SystemID string
	Path     string
	Name     string
}

type GenericDBI

type GenericDBI interface {
	Open() error
	UnsafeGetSQLDb() *sql.DB
	Truncate() error
	Allocate() error
	MigrateUp() error
	Vacuum() error
	Close() error
	GetDBPath() string
}

type HistoryEntry

type HistoryEntry struct {
	Time       time.Time `json:"time"`
	Type       string    `json:"type"`
	TokenID    string    `json:"tokenId"`
	TokenValue string    `json:"tokenValue"`
	TokenData  string    `json:"tokenData"`
	DBID       int64     `db:"DBID" json:"id"`
	Success    bool      `json:"success"`
}

type Mapping

type Mapping struct {
	Label    string `json:"label"`
	Type     string `json:"type"`
	Match    string `json:"match"`
	Pattern  string `json:"pattern"`
	Override string `json:"override"`
	DBID     int64
	Added    int64 `json:"added"`
	Enabled  bool  `json:"enabled"`
}

type Media

type Media struct {
	Path           string
	DBID           int64
	MediaTitleDBID int64
}

type MediaDBI

type MediaDBI interface {
	GenericDBI
	BeginTransaction() error
	CommitTransaction() error
	RollbackTransaction() error
	Exists() bool
	UpdateLastGenerated() error
	GetLastGenerated() (time.Time, error)

	ReindexTables() error

	SearchMediaPathExact(systems []systemdefs.System, query string) ([]SearchResult, error)
	SearchMediaPathWords(systems []systemdefs.System, query string) ([]SearchResult, error)
	SearchMediaPathGlob(systems []systemdefs.System, query string) ([]SearchResult, error)
	IndexedSystems() ([]string, error)
	SystemIndexed(system systemdefs.System) bool
	RandomGame(systems []systemdefs.System) (SearchResult, error)

	FindSystem(row System) (System, error)
	InsertSystem(row System) (System, error)
	FindOrInsertSystem(row System) (System, error)

	FindMediaTitle(row MediaTitle) (MediaTitle, error)
	InsertMediaTitle(row MediaTitle) (MediaTitle, error)
	FindOrInsertMediaTitle(row MediaTitle) (MediaTitle, error)

	FindMedia(row Media) (Media, error)
	InsertMedia(row Media) (Media, error)
	FindOrInsertMedia(row Media) (Media, error)

	FindTagType(row TagType) (TagType, error)
	InsertTagType(row TagType) (TagType, error)
	FindOrInsertTagType(row TagType) (TagType, error)

	FindTag(row Tag) (Tag, error)
	InsertTag(row Tag) (Tag, error)
	FindOrInsertTag(row Tag) (Tag, error)

	FindMediaTag(row MediaTag) (MediaTag, error)
	InsertMediaTag(row MediaTag) (MediaTag, error)
	FindOrInsertMediaTag(row MediaTag) (MediaTag, error)
}

type MediaTag

type MediaTag struct {
	DBID      int64
	MediaDBID int64
	TagDBID   int64
}

type MediaTitle

type MediaTitle struct {
	Slug       string
	Name       string
	DBID       int64
	SystemDBID int64
}

type ScanState

type ScanState struct {
	SystemIDs      map[string]int
	TitleIDs       map[string]int
	MediaIDs       map[string]int
	TagTypeIDs     map[string]int
	TagIDs         map[string]int
	SystemsIndex   int
	TitlesIndex    int
	MediaIndex     int
	TagTypesIndex  int
	TagsIndex      int
	MediaTagsIndex int
}

type SearchResult

type SearchResult struct {
	SystemID string
	Name     string
	Path     string
}

type System

type System struct {
	SystemID string
	Name     string
	DBID     int64
}

type Tag

type Tag struct {
	Tag      string
	DBID     int64
	TypeDBID int64
}

type TagType

type TagType struct {
	Type string
	DBID int64
}

type UserDBI

type UserDBI interface {
	GenericDBI
	AddHistory(entry *HistoryEntry) error
	GetHistory(lastID int) ([]HistoryEntry, error)
	AddMapping(m *Mapping) error
	GetMapping(id int64) (Mapping, error)
	DeleteMapping(id int64) error
	UpdateMapping(id int64, m *Mapping) error
	GetAllMappings() ([]Mapping, error)
	GetEnabledMappings() ([]Mapping, error)
	UpdateZapLinkHost(host string, zapscript int) error
	GetZapLinkHost(host string) (bool, bool, error)
	UpdateZapLinkCache(url string, zapscript string) error
	GetZapLinkCache(url string) (string, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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