- Building Microservices with Go
- Nic Jackson
- 67字
- 2021-07-15 17:28:05
WithValue
The WithValue method returns a copy of the parent Context in which the val value is associated with the key. The Context values are perfect to be used for request-scoped data:
func WithValue(parent Context, key interface{}, val interface{}) Context
Why not attempt to modify example 1.7 to implement a request scoped context. The key could be in the previous sentence; every request needs its own context.
推薦閱讀
- 極簡(jiǎn)算法史:從數(shù)學(xué)到機(jī)器的故事
- ASP.NET Web API:Build RESTful web applications and services on the .NET framework
- CMDB分步構(gòu)建指南
- 程序員面試算法寶典
- Learning Laravel 4 Application Development
- Learning ArcGIS Pro
- TypeScript實(shí)戰(zhàn)指南
- Learning Selenium Testing Tools(Third Edition)
- HDInsight Essentials(Second Edition)
- JavaCAPS基礎(chǔ)、應(yīng)用與案例
- NoSQL數(shù)據(jù)庫(kù)原理
- 圖數(shù)據(jù)庫(kù)實(shí)戰(zhàn)
- Mastering AWS Security
- Zabbix Performance Tuning
- IBM Cognos TM1 Developer's Certification guide