go1.16 (#14783)
This commit is contained in:
parent
030646eea4
commit
47f6a4ec3f
947 changed files with 26119 additions and 7062 deletions
27
vendor/github.com/go-chi/chi/context.go
generated
vendored
27
vendor/github.com/go-chi/chi/context.go
generated
vendored
|
@ -4,7 +4,6 @@ import (
|
|||
"context"
|
||||
"net/http"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
// URLParam returns the url parameter from a http.Request object.
|
||||
|
@ -146,32 +145,6 @@ func (s *RouteParams) Add(key, value string) {
|
|||
s.Values = append(s.Values, value)
|
||||
}
|
||||
|
||||
// directContext provides direct access to the routing *Context object,
|
||||
// while implementing the context.Context interface, thereby allowing
|
||||
// us to saving 1 allocation during routing.
|
||||
type directContext Context
|
||||
|
||||
var _ context.Context = (*directContext)(nil)
|
||||
|
||||
func (d *directContext) Deadline() (deadline time.Time, ok bool) {
|
||||
return d.parentCtx.Deadline()
|
||||
}
|
||||
|
||||
func (d *directContext) Done() <-chan struct{} {
|
||||
return d.parentCtx.Done()
|
||||
}
|
||||
|
||||
func (d *directContext) Err() error {
|
||||
return d.parentCtx.Err()
|
||||
}
|
||||
|
||||
func (d *directContext) Value(key interface{}) interface{} {
|
||||
if key == RouteCtxKey {
|
||||
return (*Context)(d)
|
||||
}
|
||||
return d.parentCtx.Value(key)
|
||||
}
|
||||
|
||||
// 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.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue