t2/views/context.go

15 lines
220 B
Go

package views
import "context"
type contextKey string
var (
PathContext = contextKey("path")
AuthContext = contextKey("auth")
)
func Username(ctx context.Context) string {
return ctx.Value(AuthContext).(string)
}