initial commit
All checks were successful
pedestrian-simulator / build (push) Successful in 53s

This commit is contained in:
2026-01-11 17:16:59 -07:00
parent c5d00dc9a9
commit 24ecddd034
18 changed files with 4506 additions and 4 deletions

18
server/context.go Normal file
View File

@@ -0,0 +1,18 @@
package main
import "context"
type contextKey string
const userIDKey contextKey = "userID"
// withUserID adds the user ID to the request context
func withUserID(ctx context.Context, userID string) context.Context {
return context.WithValue(ctx, userIDKey, userID)
}
// getUserID extracts the user ID from the request context
func getUserID(ctx context.Context) (string, bool) {
userID, ok := ctx.Value(userIDKey).(string)
return userID, ok
}