games struct stubbed
parent
81af991c58
commit
f40fdd60da
|
|
@ -0,0 +1,9 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
type Games struct {
|
||||||
|
db DB
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewGames(db DB) Games {
|
||||||
|
return Games{db: db}
|
||||||
|
}
|
||||||
|
|
@ -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{
|
||||||
|
|
|
||||||
|
|
@ -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) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue