mirror of
https://github.com/zeromicro/go-zero.git
synced 2025-01-23 17:20:24 +08:00
29 lines
400 B
Go
29 lines
400 B
Go
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,
|
|
}
|
|
}
|