update README.md for context and fan_in

This commit is contained in:
Edward 2020-05-07 11:47:50 +08:00
parent d0cc207d54
commit d020f12a2b
3 changed files with 35 additions and 19 deletions

View File

@ -7,11 +7,11 @@
"enabled": true, "enabled": true,
// words - list of words to be always considered correct // words - list of words to be always considered correct
"words": [ "words": [
"Goroutines",
"Stateful",
"Structs",
"bber", "bber",
"crazybber", "crazybber",
"fanin",
"gomore",
"Goroutines",
"ifelse", "ifelse",
"iostream", "iostream",
"istack", "istack",
@ -20,11 +20,12 @@
"mongodb", "mongodb",
"nums", "nums",
"postgres", "postgres",
"stackless",
"Stateful",
"stretchr", "stretchr",
"struct", "struct",
"xargs", "Structs",
"gomore", "xargs"
"stackless"
], ],
// flagWords - list of words to be always considered incorrect // flagWords - list of words to be always considered incorrect
// This is useful for offensive words and common spelling errors. // This is useful for offensive words and common spelling errors.

View File

@ -1,3 +1,7 @@
# 上下文模式 # 上下文模式
用于取消一个操作可能是一个http请求可能是一个Channel消息队列. 上下文模式,就是使用上下传递参数,或者传递操作。
其实在,观察者模式中,就有用到上下文模式传递参数:[观察模式中的上下文模式](../../behavior/03_observer)
这是演示使用context取消http请求的场景。

View File

@ -1 +1,12 @@
# 淡入模式 # 淡入模式
或者叫做扇入模式,漏入模式,是一种消息传递模式,用于在工作组件(客户端:源、服务器:目标)之间创建聚合工作。
对于Go其本质是将多个channel的消息/数据合并到一个,达到聚合的目的。
这里演示一个数据流,求和的例子。
注意这里演示两种FanIn方式:
+ 一种方式是多个Goroutine同时进行合并多个输入的channel.
+ 另一种方式是一个goroutine同时合并多个输入的channel数据。