Documentation ¶
Index ¶
- type MockCodec
- func (c *MockCodec) MarshalJSON(o proto.Message) ([]byte, error)
- func (c *MockCodec) MustMarshalJSON(o proto.Message) []byte
- func (c *MockCodec) MustUnmarshalJSON(bz []byte, ptr proto.Message)
- func (c *MockCodec) UnmarshalJSON(bz []byte, ptr proto.Message) error
- func (c *MockCodec) WithMarshalJSONErrs(errMsgs ...string) *MockCodec
- func (c *MockCodec) WithUnmarshalJSONErrs(errMsgs ...string) *MockCodec
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MockCodec ¶
MockCodec is a wrapper on a codec that allows injection of errors on these functions: MarshalJSON, MustMarshalJSON, UnmarshalJSON, MustUnmarshalJSON.
func NewMockCodec ¶
NewMockCodec creates a new mock codec based on the standard test encoding config codec.
func (*MockCodec) MustUnmarshalJSON ¶
func (*MockCodec) UnmarshalJSON ¶
func (*MockCodec) WithMarshalJSONErrs ¶
WithMarshalJSONErrs adds the given errors to be returned from MarshalJSON or MustMarshalJSON. Each entry is used once in the order they are provided. An empty string indicates no error (do the normal thing). The receiver is both updated and returned.
func (*MockCodec) WithUnmarshalJSONErrs ¶
WithUnmarshalJSONErrs adds the given errors to be returned from UnmarshalJSON or MustUnmarshalJSON. Each entry is used once in the order they are provided. An empty string indicates no error (do the normal thing). The receiver is both updated and returned.