games struct stubbed

main
bel 2024-12-14 21:36:08 -07:00
parent 81af991c58
commit f40fdd60da
3 changed files with 16 additions and 0 deletions

9
cmd/server/games.go Normal file
View File

@ -0,0 +1,9 @@
package main
type Games struct {
db DB
}
func NewGames(db DB) Games {
return Games{db: db}
}

View File

@ -27,10 +27,16 @@ func run(ctx context.Context) error {
return err return err
} }
db, err := NewDB(ctx, config.DB.Scheme, config.DB.Conn)
if err != nil {
return err
}
S := &S{ S := &S{
ctx: ctx, ctx: ctx,
limiter: rate.NewLimiter(10, 10), limiter: rate.NewLimiter(10, 10),
config: config, config: config,
games: NewGames(db),
} }
s := &http.Server{ s := &http.Server{

View File

@ -13,6 +13,7 @@ type S struct {
ctx context.Context ctx context.Context
limiter *rate.Limiter limiter *rate.Limiter
config Config config Config
games Games
} }
func (s *S) ServeHTTP(w http.ResponseWriter, r *http.Request) { func (s *S) ServeHTTP(w http.ResponseWriter, r *http.Request) {