Documentation ¶
Index ¶
- Variables
- func ReadUint64(r io.Reader) (uint64, int, error)
- func WriteUint64(w io.Writer, value uint64) (int, error)
- type Uint64
- func (v *Uint64) MarshalBinary() ([]byte, error)
- func (v *Uint64) MarshalText() ([]byte, error)
- func (v *Uint64) ReadFrom(r io.Reader) (int64, error)
- func (v *Uint64) SetValue(value uint64)
- func (v *Uint64) String() string
- func (v *Uint64) UnmarshalBinary(data []byte) error
- func (v *Uint64) UnmarshalText(text []byte) error
- func (v *Uint64) Value() uint64
- func (v *Uint64) WriteTo(w io.Writer) (int64, error)
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNonCanonical is a non-critical error signalizing that a non-canonical // VarU64 encoding was encountered. Operations returning ErrNonCanonical // can be considered successful. ErrNonCanonical = errors.New("varu64: non-canonical encoding") )
Functions ¶
func ReadUint64 ¶
ReadFrom decodes VarU64 from r until EOF or error, and returns decoded value, number of bytes read and an error, if any, except EOF.
Types ¶
type Uint64 ¶
type Uint64 struct { io.ReaderFrom io.WriterTo encoding.BinaryMarshaler encoding.BinaryUnmarshaler encoding.TextMarshaler encoding.TextUnmarshaler // contains filtered or unexported fields }
Uint64 is a handy data transfer object that wraps uint64 and allows encoding and decoding as defined by the VarU64 specification.
func (*Uint64) MarshalBinary ¶
MarshalBinary encodes receiver into a byte slice and returns an error, if any.
func (*Uint64) MarshalText ¶
MarshalText encodes receiver into a textual representation of VarU64 encoding.
func (*Uint64) ReadFrom ¶
ReadFrom decodes VarU64 from r until EOF or error, and sets the receiver's underlying uint64 value to the decoded one. It returns the number of bytes read and an error, if any, except EOF.
func (*Uint64) String ¶
Returns the string representation of the receiver's underlying uint64 value in base 10.
func (*Uint64) UnmarshalBinary ¶
UnmarshalBinary decodes VarU64-encoded data into the receiver.
func (*Uint64) UnmarshalText ¶
UnmarshalText decodes VarU64-encoded textual representation into the receiver.