20 lines
300 B
Go
20 lines
300 B
Go
package contexts
|
|
|
|
import "context"
|
|
|
|
type Key string
|
|
|
|
func (c Key) String() string {
|
|
return "oslstats context key " + string(c)
|
|
}
|
|
|
|
var HTMXLogKey Key = Key("htmxlog")
|
|
|
|
func HTMXLog(ctx context.Context) bool {
|
|
htmxlog, ok := ctx.Value(HTMXLogKey).(bool)
|
|
if !ok {
|
|
return false
|
|
}
|
|
return htmxlog
|
|
}
|