db

package
v0.0.0-...-7f4d16d Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateSubmissionParams

type CreateSubmissionParams struct {
	GameID   int32
	UserID   int32
	Code     string
	CodeSize int32
	CodeHash string
}

type CreateSubmissionResultParams

type CreateSubmissionResultParams struct {
	SubmissionID int32
	Status       string
	Stdout       string
	Stderr       string
}

type CreateTestcaseResultParams

type CreateTestcaseResultParams struct {
	SubmissionID int32
	TestcaseID   int32
	Status       string
	Stdout       string
	Stderr       string
}

type CreateUserAuthParams

type CreateUserAuthParams struct {
	UserID   int32
	AuthType string
}

type DBTX

type DBTX interface {
	Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error)
	Query(context.Context, string, ...interface{}) (pgx.Rows, error)
	QueryRow(context.Context, string, ...interface{}) pgx.Row
}

type Game

type Game struct {
	GameID          int32
	GameType        string
	State           string
	DisplayName     string
	DurationSeconds int32
	CreatedAt       pgtype.Timestamp
	StartedAt       pgtype.Timestamp
	ProblemID       int32
}

type GamePlayer

type GamePlayer struct {
	GameID int32
	UserID int32
}

type GetGameByIDRow

type GetGameByIDRow struct {
	GameID          int32
	GameType        string
	State           string
	DisplayName     string
	DurationSeconds int32
	CreatedAt       pgtype.Timestamp
	StartedAt       pgtype.Timestamp
	ProblemID       int32
	ProblemID_2     int32
	Title           string
	Description     string
}

type GetUserAuthByUsernameRow

type GetUserAuthByUsernameRow struct {
	UserID       int32
	Username     string
	DisplayName  string
	IconPath     *string
	IsAdmin      bool
	CreatedAt    pgtype.Timestamp
	UserAuthID   int32
	UserID_2     int32
	AuthType     string
	PasswordHash *string
}

type ListGamePlayersRow

type ListGamePlayersRow struct {
	GameID      int32
	UserID      int32
	UserID_2    int32
	Username    string
	DisplayName string
	IconPath    *string
	IsAdmin     bool
	CreatedAt   pgtype.Timestamp
}

type ListGamesForPlayerRow

type ListGamesForPlayerRow struct {
	GameID          int32
	GameType        string
	State           string
	DisplayName     string
	DurationSeconds int32
	CreatedAt       pgtype.Timestamp
	StartedAt       pgtype.Timestamp
	ProblemID       int32
	ProblemID_2     int32
	Title           string
	Description     string
	GameID_2        int32
	UserID          int32
}

type ListGamesRow

type ListGamesRow struct {
	GameID          int32
	GameType        string
	State           string
	DisplayName     string
	DurationSeconds int32
	CreatedAt       pgtype.Timestamp
	StartedAt       pgtype.Timestamp
	ProblemID       int32
	ProblemID_2     int32
	Title           string
	Description     string
}

type Problem

type Problem struct {
	ProblemID   int32
	Title       string
	Description string
}

type Queries

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

func New

func New(db DBTX) *Queries

func (*Queries) AggregateTestcaseResults

func (q *Queries) AggregateTestcaseResults(ctx context.Context, submissionID int32) (string, error)

func (*Queries) CreateSubmission

func (q *Queries) CreateSubmission(ctx context.Context, arg CreateSubmissionParams) (int32, error)

func (*Queries) CreateSubmissionResult

func (q *Queries) CreateSubmissionResult(ctx context.Context, arg CreateSubmissionResultParams) error

func (*Queries) CreateTestcaseResult

func (q *Queries) CreateTestcaseResult(ctx context.Context, arg CreateTestcaseResultParams) error

func (*Queries) CreateUser

func (q *Queries) CreateUser(ctx context.Context, username string) (int32, error)

func (*Queries) CreateUserAuth

func (q *Queries) CreateUserAuth(ctx context.Context, arg CreateUserAuthParams) error

func (*Queries) GetGameByID

func (q *Queries) GetGameByID(ctx context.Context, gameID int32) (GetGameByIDRow, error)

func (*Queries) GetSubmissionCodeSizeByID

func (q *Queries) GetSubmissionCodeSizeByID(ctx context.Context, submissionID int32) (int32, error)

func (*Queries) GetUserAuthByUsername

func (q *Queries) GetUserAuthByUsername(ctx context.Context, username string) (GetUserAuthByUsernameRow, error)

func (*Queries) GetUserByID

func (q *Queries) GetUserByID(ctx context.Context, userID int32) (User, error)

func (*Queries) GetUserIDByUsername

func (q *Queries) GetUserIDByUsername(ctx context.Context, username string) (int32, error)

func (*Queries) IsRegistrationTokenValid

func (q *Queries) IsRegistrationTokenValid(ctx context.Context, token string) (bool, error)

func (*Queries) ListGamePlayers

func (q *Queries) ListGamePlayers(ctx context.Context, gameID int32) ([]ListGamePlayersRow, error)

func (*Queries) ListGames

func (q *Queries) ListGames(ctx context.Context) ([]ListGamesRow, error)

func (*Queries) ListGamesForPlayer

func (q *Queries) ListGamesForPlayer(ctx context.Context, userID int32) ([]ListGamesForPlayerRow, error)

func (*Queries) ListTestcaseIDsByGameID

func (q *Queries) ListTestcaseIDsByGameID(ctx context.Context, gameID int32) ([]int32, error)

func (*Queries) ListTestcasesByGameID

func (q *Queries) ListTestcasesByGameID(ctx context.Context, gameID int32) ([]Testcase, error)

func (*Queries) ListUsers

func (q *Queries) ListUsers(ctx context.Context) ([]User, error)

func (*Queries) UpdateGame

func (q *Queries) UpdateGame(ctx context.Context, arg UpdateGameParams) error

func (*Queries) UpdateGameStartedAt

func (q *Queries) UpdateGameStartedAt(ctx context.Context, arg UpdateGameStartedAtParams) error

func (*Queries) UpdateGameState

func (q *Queries) UpdateGameState(ctx context.Context, arg UpdateGameStateParams) error

func (*Queries) UpdateUserIconPath

func (q *Queries) UpdateUserIconPath(ctx context.Context, arg UpdateUserIconPathParams) error

func (*Queries) WithTx

func (q *Queries) WithTx(tx pgx.Tx) *Queries

type RegistrationToken

type RegistrationToken struct {
	RegistrationTokenID int32
	Token               string
}

type Submission

type Submission struct {
	SubmissionID int32
	GameID       int32
	UserID       int32
	Code         string
	CodeSize     int32
	CodeHash     string
	CreatedAt    pgtype.Timestamp
}

type SubmissionResult

type SubmissionResult struct {
	SubmissionResultID int32
	SubmissionID       int32
	Status             string
	Stdout             string
	Stderr             string
	CreatedAt          pgtype.Timestamp
}

type Testcase

type Testcase struct {
	TestcaseID int32
	ProblemID  int32
	Stdin      string
	Stdout     string
}

type TestcaseResult

type TestcaseResult struct {
	TestcaseResultID int32
	SubmissionID     int32
	TestcaseID       int32
	Status           string
	Stdout           string
	Stderr           string
	CreatedAt        pgtype.Timestamp
}

type UpdateGameParams

type UpdateGameParams struct {
	GameID          int32
	GameType        string
	State           string
	DisplayName     string
	DurationSeconds int32
	StartedAt       pgtype.Timestamp
	ProblemID       int32
}

type UpdateGameStartedAtParams

type UpdateGameStartedAtParams struct {
	GameID    int32
	StartedAt pgtype.Timestamp
}

type UpdateGameStateParams

type UpdateGameStateParams struct {
	GameID int32
	State  string
}

type UpdateUserIconPathParams

type UpdateUserIconPathParams struct {
	UserID   int32
	IconPath *string
}

type User

type User struct {
	UserID      int32
	Username    string
	DisplayName string
	IconPath    *string
	IsAdmin     bool
	CreatedAt   pgtype.Timestamp
}

type UserAuth

type UserAuth struct {
	UserAuthID   int32
	UserID       int32
	AuthType     string
	PasswordHash *string
}

Jump to

Keyboard shortcuts

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