示例#1
0
文件: info.go 项目: tetrafolium/gae
// useGI adds a gae.GlobalInfo implementation to context, accessible
// by gae.GetGI(c)
func useGI(usrCtx context.Context) context.Context {
	probeCache := getProbeCache(usrCtx)
	if probeCache == nil {
		usrCtx = withProbeCache(usrCtx, probe(AEContext(usrCtx)))
	}

	return info.SetFactory(usrCtx, func(ci context.Context) info.Interface {
		return giImpl{ci, AEContext(ci)}
	})
}
示例#2
0
文件: info.go 项目: tetrafolium/gae
// useGI adds a gae.GlobalInfo context, accessible
// by gae.GetGI(c)
func useGI(c context.Context, appID string) context.Context {
	return info.SetFactory(c, func(ic context.Context) info.Interface {
		return &giImpl{dummy.Info(), curGID(ic), ic}
	})
}