-
Notifications
You must be signed in to change notification settings - Fork 0
/
context.go
56 lines (44 loc) · 964 Bytes
/
context.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
package dimple
import (
"context"
"time"
)
var _ FactoryCtx = (*factoryContext)(nil)
func newFactoryCtx(ctx context.Context, c *DefaultContainer, d any) FactoryCtx {
return &factoryContext{
ctx: ctx,
container: c,
decorated: d,
serviceID: *c.ref,
}
}
type factoryContext struct {
ctx context.Context
container Container
decorated any
serviceID string
}
func (f *factoryContext) ServiceID() string {
return f.serviceID
}
func (f *factoryContext) Ctx() context.Context {
return f.ctx
}
func (f *factoryContext) Deadline() (deadline time.Time, ok bool) {
return f.ctx.Deadline()
}
func (f *factoryContext) Done() <-chan struct{} {
return f.ctx.Done()
}
func (f *factoryContext) Err() error {
return f.ctx.Err()
}
func (f *factoryContext) Value(key any) any {
return f.ctx.Value(key)
}
func (f *factoryContext) Container() Container {
return f.container
}
func (f *factoryContext) Decorated() any {
return f.decorated
}