database

package
v0.0.0-...-5963213 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2020 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Populate

func Populate(mg *Manager) error

Populate database with data from files.

Types

type Manager

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

Manager that controls database access.

func NewManager

func NewManager(db *gorm.DB) *Manager

NewManager instance.

func (*Manager) AddMovie

func (mg *Manager) AddMovie(m *movie.Movie)

AddMovie to database.

func (*Manager) AddRating

func (mg *Manager) AddRating(r *rating.Rating) error

AddRating to database. Returns an error if either the movie or the user don't exist.

func (*Manager) AddUser

func (mg *Manager) AddUser(u *user.User)

AddUser to database.

func (*Manager) FetchAllUsers

func (mg *Manager) FetchAllUsers() []*user.User

FetchAllUsers present in the database.

func (*Manager) FetchMovie

func (mg *Manager) FetchMovie(id int) (*movie.Movie, error)

FetchMovie with the given ID.

func (*Manager) FetchUnseenMoviesRatings

func (mg *Manager) FetchUnseenMoviesRatings(movieIDs, userIDs []int) []*rating.Rating

FetchUnseenMoviesRatings by users in a given group.

func (*Manager) FetchUser

func (mg *Manager) FetchUser(id int) (*user.User, error)

FetchUser with the given ID.

func (*Manager) FetchUserRating

func (mg *Manager) FetchUserRating(userID, movieID int) (*rating.Rating, error)

FetchUserRating for a given movie, if it exists.

func (*Manager) GetMovieCount

func (mg *Manager) GetMovieCount() int

GetMovieCount of the database.

func (*Manager) UpdateSchemas

func (mg *Manager) UpdateSchemas()

UpdateSchemas for the database.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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