types: IsOK()

This commit is contained in:
Ethan Buchman 2017-12-02 01:48:37 -05:00
parent 8831249e95
commit 3890a2058f
1 changed files with 20 additions and 0 deletions

View File

@ -8,6 +8,11 @@ const (
CodeTypeOK uint32 = 0
)
// IsOK returns true if Code is OK.
func (r ResponseCheckTx) IsOK() bool {
return r.Code == CodeTypeOK
}
// IsErr returns true if Code is something other than OK.
func (r ResponseCheckTx) IsErr() bool {
return r.Code != CodeTypeOK
@ -18,6 +23,11 @@ func (r ResponseCheckTx) Error() string {
return fmtError(r.Code, r.Log)
}
// IsOK returns true if Code is OK.
func (r ResponseDeliverTx) IsOK() bool {
return r.Code == CodeTypeOK
}
// IsErr returns true if Code is something other than OK.
func (r ResponseDeliverTx) IsErr() bool {
return r.Code != CodeTypeOK
@ -28,6 +38,11 @@ func (r ResponseDeliverTx) Error() string {
return fmtError(r.Code, r.Log)
}
// IsOK returns true if Code is OK.
func (r ResponseCommit) IsOK() bool {
return r.Code == CodeTypeOK
}
// IsErr returns true if Code is something other than OK.
func (r ResponseCommit) IsErr() bool {
return r.Code != CodeTypeOK
@ -38,6 +53,11 @@ func (r ResponseCommit) Error() string {
return fmtError(r.Code, r.Log)
}
// IsOK returns true if Code is OK.
func (r ResponseQuery) IsOK() bool {
return r.Code == CodeTypeOK
}
// IsErr returns true if Code is something other than OK.
func (r ResponseQuery) IsErr() bool {
return r.Code != CodeTypeOK