github.com/weiwenhao/getter@v1.30.1/get_base.go (about) 1 package getter 2 3 import "context" 4 5 // getter is our base getter; it regroups 6 // fields all getters have in common. 7 type getter struct { 8 client *Client 9 } 10 11 func (g *getter) SetClient(c *Client) { g.client = c } 12 13 // Context tries to returns the Contex from the getter's 14 // client. otherwise context.Background() is returned. 15 func (g *getter) Context() context.Context { 16 if g == nil || g.client == nil { 17 return context.Background() 18 } 19 return g.client.Ctx 20 }