db

package
v0.0.0-...-5129a00 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Path     string
	Variant  string
	MaxLimit int
}

Config specifies behavior of database

type Database

type Database struct {
	// contains filtered or unexported fields
}

Database is a wrapper around Gorm-handled SQLite3 database that exposes methods useful for GameDBV information handling

func NewDatabase

func NewDatabase(cfg Config, initialData InitialData) (Database, error)

NewDatabase attempts to open the database, performing the auto-migration in the process

func OpenDatabase

func OpenDatabase(cfg Config) (Database, error)

OpenDatabase attempts to open the database

func (Database) Close

func (db Database) Close()

Close closes the underlying open db handle

func (Database) ExecuteTransactions

func (db Database) ExecuteTransactions(transactions []transaction) error

ExecuteTransactions locks the database in order to execute batch of operations

func (Database) NewGamesQuery

func (db Database) NewGamesQuery() *queries.GamesQuery

NewGamesQuery returns a query used for retrieving games

func (Database) NewLanguagesQuery

func (db Database) NewLanguagesQuery() *queries.LanguagesQuery

NewLanguagesQuery returns a query used for retrieving lanugages

func (Database) NewPlatformsQuery

func (db Database) NewPlatformsQuery() *queries.PlatformsQuery

NewPlatformsQuery returns a query used for retrieving lanugages

func (Database) NewRegionsQuery

func (db Database) NewRegionsQuery() *queries.RegionsQuery

NewRegionsQuery returns a query used for retrieving regions

func (Database) ProvidePlatformData

func (db Database) ProvidePlatformData(provider PlatformProvider) error

ProvidePlatformData takes a provider of platform's new data to be pushed to Database

type InitialData

type InitialData struct {
	Platforms []*models.Platform
}

InitialData is used for population of database with platform-independent information

type PlatformProvider

type PlatformProvider struct {
	Platform     *models.Platform
	Games        []*models.Game
	Descriptions []*models.GameDescription
	Languages    []*models.Language
	GameRegions  []*models.GameRegion
	Regions      []*models.Region
}

PlatformProvider is used for database population of a single platform's data

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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