refactor: replace hardcoded NATS subjects with typed helpers
Add GameSubject/ChatSubject helpers to connect4 and snake packages, eliminating magic string concatenation from handlers and main.go.
This commit is contained in:
@@ -7,6 +7,12 @@ import (
|
||||
"github.com/ryanhamamura/games/player"
|
||||
)
|
||||
|
||||
// NATS subject helpers.
|
||||
const SubjectPrefix = "snake"
|
||||
|
||||
func GameSubject(gameID string) string { return SubjectPrefix + "." + gameID }
|
||||
func ChatSubject(gameID string) string { return SubjectPrefix + ".chat." + gameID }
|
||||
|
||||
type Direction int
|
||||
|
||||
const (
|
||||
|
||||
Reference in New Issue
Block a user