add db package

db package allows for writing games to postgres db
This commit is contained in:
Bhavnoor Singh Saroya 2025-08-18 21:29:05 -07:00
parent 7426ddaf74
commit 38368ba151
2 changed files with 106 additions and 0 deletions

View file

@ -16,6 +16,8 @@ import (
"sync"
"time"
// adding custom stuff here
"github.com/BattlesnakeOfficial/rules"
"github.com/BattlesnakeOfficial/rules/board"
"github.com/BattlesnakeOfficial/rules/client"
@ -25,8 +27,15 @@ import (
"github.com/pkg/browser"
"github.com/spf13/cobra"
log "github.com/spf13/jwalterweatherman"
// adding custom stuff below here
"github.com/jackc/pgx/v5/pgxpool"
)
var db *pgxpool.Pool // global database connection pool
// store frames in memory for now
// will write to db at end of game
var frames []board.GameEvent
// Used to store state for each SnakeState while running a local game