 Documentation
      ¶
      Documentation
      ¶
    
    
  
    
  
    Index ¶
Constants ¶
      View Source
      
  
const (
	VersionSize = wrappers.ShortLen
)
    Variables ¶
      View Source
      
  
    var ( ErrUnsupportedType = errors.New("unsupported type") ErrMaxSliceLenExceeded = errors.New("max slice length exceeded") ErrDoesNotImplementInterface = errors.New("does not implement interface") ErrUnexportedField = errors.New("unexported field") ErrExtraSpace = errors.New("trailing buffer space") ErrMarshalZeroLength = errors.New("can't marshal zero length value") ErrUnmarshalZeroLength = errors.New("can't unmarshal zero length value") )
      View Source
      
  
    var ( ErrUnknownVersion = errors.New("unknown codec version") ErrMarshalNil = errors.New("can't marshal nil pointer or interface") ErrUnmarshalNil = errors.New("can't unmarshal nil") ErrUnmarshalTooBig = errors.New("byte array exceeds maximum length") ErrCantPackVersion = errors.New("couldn't pack codec version") ErrCantUnpackVersion = errors.New("couldn't unpack codec version") ErrDuplicatedVersion = errors.New("duplicated codec version") )
      View Source
      
  
var ErrDuplicateType = errors.New("duplicate type registration")
    Functions ¶
This section is empty.
Types ¶
type Codec ¶
type Codec interface {
	MarshalInto(interface{}, *wrappers.Packer) error
	Unmarshal([]byte, interface{}) error
	// Returns the size, in bytes, of [value] when it's marshaled
	Size(value interface{}) (int, error)
}
    Codec marshals and unmarshals
type GeneralCodec ¶
GeneralCodec marshals and unmarshals structs including interfaces
type Manager ¶
type Manager interface {
	// Associate the given codec with the given version ID
	RegisterCodec(version uint16, codec Codec) error
	// Size returns the size, in bytes, of [value] when it's marshaled
	// using the codec with the given version.
	// RegisterCodec must have been called with that version.
	// If [value] is nil, returns [ErrMarshalNil]
	Size(version uint16, value interface{}) (int, error)
	// Marshal the given value using the codec with the given version.
	// RegisterCodec must have been called with that version.
	Marshal(version uint16, source interface{}) (destination []byte, err error)
	// Unmarshal the given bytes into the given destination. [destination] must
	// be a pointer or an interface. Returns the version of the codec that
	// produces the given bytes.
	Unmarshal(source []byte, destination interface{}) (version uint16, err error)
}
    Manager describes the functionality for managing codec versions.
func NewDefaultManager ¶
func NewDefaultManager() Manager
NewDefaultManager returns a new codec manager.
       Directories
      ¶
      Directories
      ¶
    
    | Path | Synopsis | 
|---|---|
| Package codecmock is a generated GoMock package. | Package codecmock is a generated GoMock package. | 
| Package codectest provides a test suite for testing codec implementations. | Package codectest provides a test suite for testing codec implementations. | 
 Click to show internal directories. 
   Click to hide internal directories.