codec

package
v1.4.3-prerelease03 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 2, 2026 License: Apache-2.0 Imports: 7 Imported by: 5 modules, 14 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package codec is a generated GoMock package.

Index

Constants

This section is empty.

Variables

View Source
var (
	// MissingBinaryEncodingVersion indicate that the encoding version is missing
	MissingBinaryEncodingVersion = &types.BadRequestError{Message: "Missing binary encoding version."}
	// InvalidBinaryEncodingVersion indicate that the encoding version is incorrect
	InvalidBinaryEncodingVersion = &types.BadRequestError{Message: "Invalid binary encoding version."}
	// MsgPayloadNotThriftEncoded indicate message is not thrift encoded
	MsgPayloadNotThriftEncoded = &types.BadRequestError{Message: "Message payload is not thrift encoded."}
)

Functions

This section is empty.

Types

type BinaryEncoder

type BinaryEncoder interface {
	Encode(obj ThriftObject) ([]byte, error)
	Decode(payload []byte, val ThriftObject) error
}

BinaryEncoder represent the encoder which can serialize or deserialize object

type MockBinaryEncoder added in v1.2.15

type MockBinaryEncoder struct {
	// contains filtered or unexported fields
}

MockBinaryEncoder is a mock of BinaryEncoder interface.

func NewMockBinaryEncoder added in v1.2.15

func NewMockBinaryEncoder(ctrl *gomock.Controller) *MockBinaryEncoder

NewMockBinaryEncoder creates a new mock instance.

func (*MockBinaryEncoder) Decode added in v1.2.15

func (m *MockBinaryEncoder) Decode(payload []byte, val ThriftObject) error

Decode mocks base method.

func (*MockBinaryEncoder) EXPECT added in v1.2.15

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockBinaryEncoder) Encode added in v1.2.15

func (m *MockBinaryEncoder) Encode(obj ThriftObject) ([]byte, error)

Encode mocks base method.

type MockBinaryEncoderMockRecorder added in v1.2.15

type MockBinaryEncoderMockRecorder struct {
	// contains filtered or unexported fields
}

MockBinaryEncoderMockRecorder is the mock recorder for MockBinaryEncoder.

func (*MockBinaryEncoderMockRecorder) Decode added in v1.2.15

func (mr *MockBinaryEncoderMockRecorder) Decode(payload, val any) *gomock.Call

Decode indicates an expected call of Decode.

func (*MockBinaryEncoderMockRecorder) Encode added in v1.2.15

func (mr *MockBinaryEncoderMockRecorder) Encode(obj any) *gomock.Call

Encode indicates an expected call of Encode.

type ThriftObject

type ThriftObject interface {
	FromWire(w wire.Value) error
	ToWire() (wire.Value, error)
	Encode(stream.Writer) error
	Decode(stream.Reader) error
}

ThriftObject represents a thrift object

type ThriftRWEncoder

type ThriftRWEncoder struct {
}

ThriftRWEncoder is an implementation using thrift rw for binary encoding / decoding NOTE: this encoder only works for thrift struct

func NewThriftRWEncoder

func NewThriftRWEncoder() *ThriftRWEncoder

NewThriftRWEncoder generate a new ThriftRWEncoder

func (*ThriftRWEncoder) Decode

func (t *ThriftRWEncoder) Decode(b []byte, val ThriftObject) error

Decode decode the object

func (*ThriftRWEncoder) Encode

func (t *ThriftRWEncoder) Encode(obj ThriftObject) ([]byte, error)

Encode encode the object

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL