From 07a9ddb2d50e3ade645881c850b45489c32231d5 Mon Sep 17 00:00:00 2001 From: Ethan Buchman Date: Wed, 23 May 2018 22:49:13 -0400 Subject: [PATCH] result.go is json.go and codetype.go --- types/codetype.go | 35 +++++++++++++++++++++++++++++++++++ types/{result.go => json.go} | 34 ---------------------------------- 2 files changed, 35 insertions(+), 34 deletions(-) create mode 100644 types/codetype.go rename types/{result.go => json.go} (76%) diff --git a/types/codetype.go b/types/codetype.go new file mode 100644 index 000000000..5355a498b --- /dev/null +++ b/types/codetype.go @@ -0,0 +1,35 @@ +package types + +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 +} + +// 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 +} + +// 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 +} diff --git a/types/result.go b/types/json.go similarity index 76% rename from types/result.go rename to types/json.go index dbf409f4c..dbd7f0617 100644 --- a/types/result.go +++ b/types/json.go @@ -7,40 +7,6 @@ import ( "github.com/gogo/protobuf/jsonpb" ) -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 -} - -// 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 -} - -// 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 -} - //--------------------------------------------------------------------------- // override JSON marshalling so we dont emit defaults (ie. disable omitempty) // note we need Unmarshal functions too because protobuf had the bright idea