context_pre17.go 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. // Copyright 2018 Gin Core Team. All rights reserved.
  2. // Use of this source code is governed by a MIT style
  3. // license that can be found in the LICENSE file.
  4. // +build !go1.7
  5. package gin
  6. import (
  7. "time"
  8. )
  9. /************************************/
  10. /***** GOLANG.ORG/X/NET/CONTEXT *****/
  11. /************************************/
  12. // Deadline returns the time when work done on behalf of this context
  13. // should be canceled. Deadline returns ok==false when no deadline is
  14. // set. Successive calls to Deadline return the same results.
  15. func (c *Context) Deadline() (deadline time.Time, ok bool) {
  16. return
  17. }
  18. // Done returns a channel that's closed when work done on behalf of this
  19. // context should be canceled. Done may return nil if this context can
  20. // never be canceled. Successive calls to Done return the same value.
  21. func (c *Context) Done() <-chan struct{} {
  22. return nil
  23. }
  24. // Err returns a non-nil error value after Done is closed,
  25. // successive calls to Err return the same error.
  26. // If Done is not yet closed, Err returns nil.
  27. // If Done is closed, Err returns a non-nil error explaining why:
  28. // Canceled if the context was canceled
  29. // or DeadlineExceeded if the context's deadline passed.
  30. func (c *Context) Err() error {
  31. return nil
  32. }