You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
400 B
Go
29 lines
400 B
Go
4 years ago
|
package contextx
|
||
|
|
||
|
import (
|
||
|
"context"
|
||
|
"time"
|
||
|
)
|
||
|
|
||
|
type valueOnlyContext struct {
|
||
|
context.Context
|
||
|
}
|
||
|
|
||
|
func (valueOnlyContext) Deadline() (deadline time.Time, ok bool) {
|
||
|
return
|
||
|
}
|
||
|
|
||
|
func (valueOnlyContext) Done() <-chan struct{} {
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
func (valueOnlyContext) Err() error {
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
func ValueOnlyFrom(ctx context.Context) context.Context {
|
||
|
return valueOnlyContext{
|
||
|
Context: ctx,
|
||
|
}
|
||
|
}
|