mirror of
https://github.com/crazybber/go-pattern-examples.git
synced 2024-11-22 11:56:03 +03:00
update update contents
This commit is contained in:
parent
94b8f71cc6
commit
78ae8f6954
3
.vscode/settings.json
vendored
3
.vscode/settings.json
vendored
@ -47,6 +47,7 @@
|
||||
},
|
||||
"fileheader.Author":"Edward",
|
||||
"fileheader.tpl": "/*\r\n * @Description: https://github.com/crazybber\r\n * @Author: {author}\r\n * @Date: {createTime}\r\n * @Last Modified by: {lastModifiedBy}\r\n * @Last Modified time: {updateTime}\r\n */\r\n\r\n",
|
||||
"fileheader.LastModifiedBy": "Edward"
|
||||
"fileheader.LastModifiedBy": "Edward",
|
||||
"peacock.color": "#5e7959"
|
||||
}
|
||||
//https://vscode.readthedocs.io/en/latest/getstarted/settings/
|
||||
|
@ -70,6 +70,16 @@ func NewRequestBreaker(opts ...Option) *RequestBreaker {
|
||||
}
|
||||
}
|
||||
|
||||
// Do runs the given request if the RequestBreaker accepts it.
|
||||
// Do returns an error instantly if the RequestBreaker rejects the request.
|
||||
// Otherwise, Execute returns the result of the request.
|
||||
// If a panic occurs in the request, the RequestBreaker handles it as an error and causes the same panic again.
|
||||
func (rb *RequestBreaker) Do(req func() (interface{}, error)) (interface{}, error) {
|
||||
|
||||
result, err := req()
|
||||
return result, err
|
||||
}
|
||||
|
||||
//State of current switch
|
||||
type State int
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user