1
0
Fork 0
mirror of https://github.com/miniflux/v2.git synced 2025-09-15 18:57:04 +00:00

Simplify context keys

This commit is contained in:
Frédéric Guillot 2018-08-25 09:50:43 -07:00
parent 4148d8af80
commit c327833314
2 changed files with 19 additions and 49 deletions

View file

@ -92,7 +92,7 @@ func (c *Context) PocketRequestToken() string {
return c.getContextStringValue(middleware.PocketRequestTokenContextKey)
}
func (c *Context) getContextStringValue(key *middleware.ContextKey) string {
func (c *Context) getContextStringValue(key middleware.ContextKey) string {
if v := c.request.Context().Value(key); v != nil {
return v.(string)
}
@ -100,7 +100,7 @@ func (c *Context) getContextStringValue(key *middleware.ContextKey) string {
return ""
}
func (c *Context) getContextBoolValue(key *middleware.ContextKey) bool {
func (c *Context) getContextBoolValue(key middleware.ContextKey) bool {
if v := c.request.Context().Value(key); v != nil {
return v.(bool)
}
@ -108,7 +108,7 @@ func (c *Context) getContextBoolValue(key *middleware.ContextKey) bool {
return false
}
func (c *Context) getContextIntValue(key *middleware.ContextKey) int64 {
func (c *Context) getContextIntValue(key middleware.ContextKey) int64 {
if v := c.request.Context().Value(key); v != nil {
return v.(int64)
}