dealroom/internal/handler/context.go

20 lines
368 B
Go

package handler
import (
"context"
"dealroom/internal/model"
)
type contextKey string
const profileKey contextKey = "profile"
func setProfile(ctx context.Context, p *model.Profile) context.Context {
return context.WithValue(ctx, profileKey, p)
}
func getProfile(ctx context.Context) *model.Profile {
p, _ := ctx.Value(profileKey).(*model.Profile)
return p
}