go 编程模型 常用结构

https://coolshell.cn/articles/21128.html
https://coolshell.cn/articles/21140.html
https://coolshell.cn/articles/21146.html
//使用一个builder类来做包装
type ServerBuilder struct {
Server
}
func (sb *ServerBuilder) Create(addr string, port int) *ServerBuilder {
sb.Server.Addr = addr
sb.Server.Port = port
//其它代码设置其它成员的默认值
return sb
}
func (sb *ServerBuilder) WithProtocol(protocol string) *ServerBuilder {
sb.Server.Protocol = protocol
return sb
}
func (sb *ServerBuilder) WithMaxConn( maxconn int) *ServerBuilder {
sb.Server.MaxConns = maxconn
return sb
}



https://coolshell.cn/articles/21214.html



https://coolshell.cn/articles/21164.html



https://coolshell.cn/articles/21179.html





https://coolshell.cn/articles/17929.html
https://coolshell.cn/articles/21228.html
https://coolshell.cn/articles/21263.html
https://coolshell.cn/articles/21615.html


Category golang