neko/server/internal/http/middleware/middleware.go

13 lines
358 B
Go
Raw Normal View History

2020-01-13 21:05:38 +13:00
package middleware
// contextKey is a value for use with context.WithValue. It's used as
// a pointer so it fits in an interface{} without allocation. This technique
// for defining context keys was copied from Go 1.7's new use of context in net/http.
type ctxKey struct {
2020-01-19 12:30:09 +13:00
name string
2020-01-13 21:05:38 +13:00
}
func (k *ctxKey) String() string {
2020-01-19 12:30:09 +13:00
return "neko/ctx/" + k.name
2020-01-13 21:05:38 +13:00
}