database

package
v0.0.0-...-2eb796a Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2023 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultQueryTimeout = 5 * time.Second

Variables

This section is empty.

Functions

This section is empty.

Types

type Database

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

func New

func New(dsn string) (*Database, error)

func (*Database) Close

func (db *Database) Close() error

func (*Database) CreateGame

func (db *Database) CreateGame(blackUserID, whiteUserID int64) (gameID int64, err error)

func (*Database) CreateMove

func (db *Database) CreateMove(gameID, userID int64, x, y int) error

func (*Database) CreateUser

func (db *Database) CreateUser(username, email, passwordBcrypt string) (*model.User, error)

func (*Database) CreateUserOauth

func (db *Database) CreateUserOauth(username string, email *string, oauthID string, service oauth.Service) (*model.User, error)

func (*Database) DeclineGameInvitation

func (db *Database) DeclineGameInvitation(userID int64, gameID int64) error

func (*Database) DeleteGame

func (db *Database) DeleteGame(gameID int64) error

func (*Database) FindUsers

func (db *Database) FindUsers(username string) ([]*model.User, error)

func (*Database) FinishGameWithWinner

func (db *Database) FinishGameWithWinner(gameID, winnerID int64) error

func (*Database) GameHistory

func (db *Database) GameHistory(username string) ([]model.GameHistoryItem, error)

func (*Database) GetGameByID

func (db *Database) GetGameByID(gameID int64) (*model.Game, error)

func (*Database) GetGameMovesByID

func (db *Database) GetGameMovesByID(gameID int64) ([]model.Move, error)

func (*Database) GetPlayingGame

func (db *Database) GetPlayingGame(userID int64) (*model.PlayingGame, error)

func (*Database) GetUserByID

func (db *Database) GetUserByID(userID int64) (*model.User, error)

func (*Database) GetUserByLogin

func (db *Database) GetUserByLogin(login string) (*model.User, error)

func (*Database) IsGameMember

func (db *Database) IsGameMember(userID, gameID int64) (bool, error)

func (*Database) IsPlaying

func (db *Database) IsPlaying(userID int64) (bool, error)

func (*Database) ReadConfig

func (db *Database) ReadConfig() (*config.Config, error)

func (*Database) StartGame

func (db *Database) StartGame(gameID int64) error

func (*Database) Top10

func (db *Database) Top10() ([]*model.User, error)

Jump to

Keyboard shortcuts

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