Browse Source

types: IsOK()

pull/1780/head
Ethan Buchman 7 years ago
parent
commit
3890a2058f
1 changed files with 20 additions and 0 deletions
  1. +20
    -0
      types/result.go

+ 20
- 0
types/result.go View File

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


Loading…
Cancel
Save