1 Star 0 Fork 0

lihaiping1603 / utils

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
options.go 645 Bytes
一键复制 编辑 原始数据 按行查看 历史
package xhttp
import "time"
type Option interface {
apply(*ServerEngine)
}
// optionFunc wraps a func so it satisfies the Option interface.
type optionFunc func(*ServerEngine)
func (f optionFunc) apply(server *ServerEngine) {
f(server)
}
func WithReadTimeout(rt time.Duration) Option {
return optionFunc(func(server *ServerEngine) {
server.srv.ReadTimeout = rt
})
}
func WithWriteTimeout(wt time.Duration) Option {
return optionFunc(func(server *ServerEngine) {
server.srv.WriteTimeout = wt
})
}
func WithIdleTimeout(it time.Duration) Option {
return optionFunc(func(server *ServerEngine) {
server.srv.IdleTimeout = it
})
}
Go
1
https://gitee.com/lihaiping1603/utils.git
git@gitee.com:lihaiping1603/utils.git
lihaiping1603
utils
utils
6ffc9e3a73a3

搜索帮助