Files
secunda_test/internal/httpx/context.go
T
2026-06-22 14:31:01 +05:00

15 lines
288 B
Go

package httpx
import "context"
type userIDKey struct{}
func WithUserID(ctx context.Context, userID int64) context.Context {
return context.WithValue(ctx, userIDKey{}, userID)
}
func UserID(ctx context.Context) (int64, bool) {
v, ok := ctx.Value(userIDKey{}).(int64)
return v, ok
}