- Replace Create+Get+Update with UpsertGame/UpsertSnakeGame queries - Extract free functions (saveGame, loadGame, etc.) from duplicated receiver methods on Store and Instance types - Remove duplicate generateID from snake package, reuse game.GenerateID - Throttle snake game DB writes to every 2s instead of every tick - Fix double-lock in c4game chat handler - Update all code for sqlc pointer types (*string instead of sql.NullString)
61 lines
2.2 KiB
Go
61 lines
2.2 KiB
Go
// Code generated by sqlc. DO NOT EDIT.
|
|
// versions:
|
|
// sqlc v1.30.0
|
|
|
|
package repository
|
|
|
|
import (
|
|
"time"
|
|
)
|
|
|
|
type ChatMessage struct {
|
|
ID int64 `db:"id" json:"id"`
|
|
GameID string `db:"game_id" json:"game_id"`
|
|
Nickname string `db:"nickname" json:"nickname"`
|
|
Color int64 `db:"color" json:"color"`
|
|
Message string `db:"message" json:"message"`
|
|
CreatedAt int64 `db:"created_at" json:"created_at"`
|
|
}
|
|
|
|
type Game struct {
|
|
ID string `db:"id" json:"id"`
|
|
Board string `db:"board" json:"board"`
|
|
CurrentTurn int64 `db:"current_turn" json:"current_turn"`
|
|
Status int64 `db:"status" json:"status"`
|
|
WinnerUserID *string `db:"winner_user_id" json:"winner_user_id"`
|
|
WinningCells *string `db:"winning_cells" json:"winning_cells"`
|
|
CreatedAt *time.Time `db:"created_at" json:"created_at"`
|
|
UpdatedAt *time.Time `db:"updated_at" json:"updated_at"`
|
|
RematchGameID *string `db:"rematch_game_id" json:"rematch_game_id"`
|
|
GameType string `db:"game_type" json:"game_type"`
|
|
GridWidth *int64 `db:"grid_width" json:"grid_width"`
|
|
GridHeight *int64 `db:"grid_height" json:"grid_height"`
|
|
MaxPlayers int64 `db:"max_players" json:"max_players"`
|
|
GameMode int64 `db:"game_mode" json:"game_mode"`
|
|
Score int64 `db:"score" json:"score"`
|
|
SnakeSpeed int64 `db:"snake_speed" json:"snake_speed"`
|
|
}
|
|
|
|
type GamePlayer struct {
|
|
GameID string `db:"game_id" json:"game_id"`
|
|
UserID *string `db:"user_id" json:"user_id"`
|
|
GuestPlayerID *string `db:"guest_player_id" json:"guest_player_id"`
|
|
Nickname string `db:"nickname" json:"nickname"`
|
|
Color int64 `db:"color" json:"color"`
|
|
Slot int64 `db:"slot" json:"slot"`
|
|
CreatedAt *time.Time `db:"created_at" json:"created_at"`
|
|
}
|
|
|
|
type Session struct {
|
|
Token string `db:"token" json:"token"`
|
|
Data []byte `db:"data" json:"data"`
|
|
Expiry float64 `db:"expiry" json:"expiry"`
|
|
}
|
|
|
|
type User struct {
|
|
ID string `db:"id" json:"id"`
|
|
Username string `db:"username" json:"username"`
|
|
PasswordHash string `db:"password_hash" json:"password_hash"`
|
|
CreatedAt *time.Time `db:"created_at" json:"created_at"`
|
|
}
|