github.com/switchupcb/yaegi@v0.10.2/stdlib/go1_17_context.go (about) 1 // Code generated by 'yaegi extract context'. DO NOT EDIT. 2 3 //go:build go1.17 4 // +build go1.17 5 6 package stdlib 7 8 import ( 9 "context" 10 "reflect" 11 "time" 12 ) 13 14 func init() { 15 Symbols["context/context"] = map[string]reflect.Value{ 16 // function, constant and variable definitions 17 "Background": reflect.ValueOf(context.Background), 18 "Canceled": reflect.ValueOf(&context.Canceled).Elem(), 19 "DeadlineExceeded": reflect.ValueOf(&context.DeadlineExceeded).Elem(), 20 "TODO": reflect.ValueOf(context.TODO), 21 "WithCancel": reflect.ValueOf(context.WithCancel), 22 "WithDeadline": reflect.ValueOf(context.WithDeadline), 23 "WithTimeout": reflect.ValueOf(context.WithTimeout), 24 "WithValue": reflect.ValueOf(context.WithValue), 25 26 // type definitions 27 "CancelFunc": reflect.ValueOf((*context.CancelFunc)(nil)), 28 "Context": reflect.ValueOf((*context.Context)(nil)), 29 30 // interface wrapper definitions 31 "_Context": reflect.ValueOf((*_context_Context)(nil)), 32 } 33 } 34 35 // _context_Context is an interface wrapper for Context type 36 type _context_Context struct { 37 IValue interface{} 38 WDeadline func() (deadline time.Time, ok bool) 39 WDone func() <-chan struct{} 40 WErr func() error 41 WValue func(key interface{}) interface{} 42 } 43 44 func (W _context_Context) Deadline() (deadline time.Time, ok bool) { 45 return W.WDeadline() 46 } 47 func (W _context_Context) Done() <-chan struct{} { 48 return W.WDone() 49 } 50 func (W _context_Context) Err() error { 51 return W.WErr() 52 } 53 func (W _context_Context) Value(key interface{}) interface{} { 54 return W.WValue(key) 55 }