Documentation ¶
Index ¶
- Constants
- Variables
- func Marshal(v interface{}) ([]byte, error)
- func Serialize(v interface{}, simple bool) ([]byte, error)
- func Unmarshal(b []byte, p interface{}) error
- func Unserialize(b []byte, p interface{}, simple bool) error
- type BufReader
- type BufWriter
- type BytesReader
- type RawReader
- type Reader
- func (r *Reader) CheckTag(expectTag byte) error
- func (r *Reader) CheckTags(expectTags []byte) (tag byte, err error)
- func (r *Reader) ReadArray(a []reflect.Value) error
- func (r *Reader) ReadBigInt() (*big.Int, error)
- func (r *Reader) ReadBigIntWithoutTag() (*big.Int, error)
- func (r *Reader) ReadBool() (bool, error)
- func (r *Reader) ReadBytes() (*[]byte, error)
- func (r *Reader) ReadBytesWithoutTag() (*[]byte, error)
- func (r *Reader) ReadDateTime() (time.Time, error)
- func (r *Reader) ReadDateWithoutTag() (time.Time, error)
- func (r *Reader) ReadFloat32() (float32, error)
- func (r *Reader) ReadFloat32WithoutTag() (float32, error)
- func (r *Reader) ReadFloat64() (float64, error)
- func (r *Reader) ReadFloat64WithoutTag() (float64, error)
- func (r *Reader) ReadInt() (int, error)
- func (r *Reader) ReadInt16() (int16, error)
- func (r *Reader) ReadInt16WithoutTag() (int16, error)
- func (r *Reader) ReadInt32() (int32, error)
- func (r *Reader) ReadInt32WithoutTag() (int32, error)
- func (r *Reader) ReadInt64() (int64, error)
- func (r *Reader) ReadInt64WithoutTag() (int64, error)
- func (r *Reader) ReadInt8() (int8, error)
- func (r *Reader) ReadInt8WithoutTag() (int8, error)
- func (r *Reader) ReadIntWithoutTag() (int, error)
- func (r *Reader) ReadInteger(tag byte) (int, error)
- func (r *Reader) ReadList() (*list.List, error)
- func (r *Reader) ReadListWithoutTag() (*list.List, error)
- func (r *Reader) ReadMap(p interface{}) error
- func (r *Reader) ReadMapWithoutTag(p interface{}) error
- func (r *Reader) ReadObject(p interface{}) error
- func (r *Reader) ReadObjectWithoutTag(p interface{}) error
- func (r *Reader) ReadSlice(p interface{}) error
- func (r *Reader) ReadSliceWithoutTag(p interface{}) error
- func (r *Reader) ReadString() (string, error)
- func (r *Reader) ReadStringWithoutTag() (str string, err error)
- func (r *Reader) ReadTimeWithoutTag() (time.Time, error)
- func (r *Reader) ReadUUID() (*UUID, error)
- func (r *Reader) ReadUUIDWithoutTag() (*UUID, error)
- func (r *Reader) ReadUint() (uint, error)
- func (r *Reader) ReadUint16() (uint16, error)
- func (r *Reader) ReadUint16WithoutTag() (uint16, error)
- func (r *Reader) ReadUint32() (uint32, error)
- func (r *Reader) ReadUint32WithoutTag() (uint32, error)
- func (r *Reader) ReadUint64() (uint64, error)
- func (r *Reader) ReadUint64WithoutTag() (uint64, error)
- func (r *Reader) ReadUint8() (uint8, error)
- func (r *Reader) ReadUint8WithoutTag() (uint8, error)
- func (r *Reader) ReadUintWithoutTag() (uint, error)
- func (r *Reader) ReadUinteger(tag byte) (uint, error)
- func (r *Reader) ReadValue(v reflect.Value) error
- func (r *Reader) Reset()
- func (r *Reader) Unserialize(p interface{}) (err error)
- type UUID
- type Writer
- func (w *Writer) Reset()
- func (w *Writer) Serialize(v interface{}) (err error)
- func (w *Writer) WriteArray(v []reflect.Value) (err error)
- func (w *Writer) WriteBigInt(v *big.Int) (err error)
- func (w *Writer) WriteBool(v bool) error
- func (w *Writer) WriteBytes(bytes []byte) (err error)
- func (w *Writer) WriteBytesWithRef(bytes []byte) (err error)
- func (w *Writer) WriteFloat64(v float64) (err error)
- func (w *Writer) WriteInt64(v int64) (err error)
- func (w *Writer) WriteNull() error
- func (w *Writer) WriteString(str string) (err error)
- func (w *Writer) WriteStringWithRef(str string) (err error)
- func (w *Writer) WriteTime(t time.Time) (err error)
- func (w *Writer) WriteUint64(v uint64) (err error)
- func (w *Writer) WriteValue(v reflect.Value) (err error)
Constants ¶
const ( /* Serialize Tags */ TagInteger byte = 'i' TagLong byte = 'l' TagDouble byte = 'd' TagNull byte = 'n' TagEmpty byte = 'e' TagTrue byte = 't' TagFalse byte = 'f' TagNaN byte = 'N' TagInfinity byte = 'I' TagDate byte = 'D' TagTime byte = 'T' TagUTC byte = 'Z' TagBytes byte = 'b' TagUTF8Char byte = 'u' TagString byte = 's' TagGuid byte = 'g' TagList byte = 'a' TagMap byte = 'm' TagClass byte = 'c' TagObject byte = 'o' TagRef byte = 'r' /* Serialize Marks */ TagPos byte = '+' TagNeg byte = '-' TagSemicolon byte = ';' TagOpenbrace byte = '{' TagClosebrace byte = '}' TagQuote byte = '"' TagPoint byte = '.' /* Protocol Tags */ TagFunctions byte = 'F' TagCall byte = 'C' TagResult byte = 'R' TagArgument byte = 'A' TagError byte = 'E' TagEnd byte = 'z' )
Variables ¶
var ClassManager = initClassManager()
ClassManager used to be register class with alias for hprose serialize/unserialize.
var ErrNil = errors.New("nil")
ErrNil is a error of nil
Functions ¶
Types ¶
type BufReader ¶
type BufReader interface { Read(p []byte) (n int, err error) ReadByte() (c byte, err error) ReadRune() (r rune, size int, err error) ReadString(delim byte) (line string, err error) }
BufReader is buffer reader interface, Hprose Reader use it as input stream.
type BufWriter ¶
type BufWriter interface { Write(p []byte) (n int, err error) WriteByte(c byte) error WriteRune(r rune) (n int, err error) WriteString(s string) (n int, err error) }
BufWriter is buffer writer interface, Hprose Writer use it as output stream.
type BytesReader ¶
BytesReader is a bytes reader
func NewBytesReader ¶
func NewBytesReader(b []byte) (reader *BytesReader)
NewBytesReader is the constructor of BytesReader
func (*BytesReader) Read ¶
func (r *BytesReader) Read(b []byte) (n int, err error)
Read bytes from BytesReader
func (*BytesReader) ReadByte ¶
func (r *BytesReader) ReadByte() (b byte, err error)
ReadByte from BytesReader
func (*BytesReader) ReadRune ¶
func (r *BytesReader) ReadRune() (ch rune, size int, err error)
ReadRune from BytesReader
func (*BytesReader) ReadString ¶
func (r *BytesReader) ReadString(delim byte) (line string, err error)
ReadString from BytesReader
type RawReader ¶
type RawReader struct {
Stream BufReader
}
RawReader is the hprose raw reader
func NewRawReader ¶
NewRawReader is a constructor for RawReader
type Reader ¶
Reader is a fine-grained operation struct for Hprose unserialization when JSONCompatible is true, the Map data will unserialize to map[string]interface as the default type
func (*Reader) ReadBigIntWithoutTag ¶
ReadBigIntWithoutTag from stream
func (*Reader) ReadBytesWithoutTag ¶
ReadBytesWithoutTag from stream
func (*Reader) ReadDateTime ¶
ReadDateTime from stream
func (*Reader) ReadDateWithoutTag ¶
ReadDateWithoutTag from stream
func (*Reader) ReadFloat32 ¶
ReadFloat32 from stream
func (*Reader) ReadFloat32WithoutTag ¶
ReadFloat32WithoutTag from stream
func (*Reader) ReadFloat64 ¶
ReadFloat64 from stream
func (*Reader) ReadFloat64WithoutTag ¶
ReadFloat64WithoutTag from stream
func (*Reader) ReadInt16WithoutTag ¶
ReadInt16WithoutTag from stream
func (*Reader) ReadInt32WithoutTag ¶
ReadInt32WithoutTag from stream
func (*Reader) ReadInt64WithoutTag ¶
ReadInt64WithoutTag from stream
func (*Reader) ReadInt8WithoutTag ¶
ReadInt8WithoutTag from stream
func (*Reader) ReadIntWithoutTag ¶
ReadIntWithoutTag from stream
func (*Reader) ReadInteger ¶
ReadInteger from stream
func (*Reader) ReadListWithoutTag ¶
ReadListWithoutTag from stream
func (*Reader) ReadMapWithoutTag ¶
ReadMapWithoutTag from stream
func (*Reader) ReadObjectWithoutTag ¶
ReadObjectWithoutTag from stream
func (*Reader) ReadSliceWithoutTag ¶
ReadSliceWithoutTag from stream
func (*Reader) ReadStringWithoutTag ¶
ReadStringWithoutTag from stream
func (*Reader) ReadTimeWithoutTag ¶
ReadTimeWithoutTag from stream
func (*Reader) ReadUUIDWithoutTag ¶
ReadUUIDWithoutTag from stream
func (*Reader) ReadUint16WithoutTag ¶
ReadUint16WithoutTag from stream
func (*Reader) ReadUint32WithoutTag ¶
ReadUint32WithoutTag from stream
func (*Reader) ReadUint64WithoutTag ¶
ReadUint64WithoutTag from stream
func (*Reader) ReadUint8WithoutTag ¶
ReadUint8WithoutTag from stream
func (*Reader) ReadUintWithoutTag ¶
ReadUintWithoutTag from stream
func (*Reader) ReadUinteger ¶
ReadUinteger from stream
func (*Reader) Unserialize ¶
Unserialize a data from stream
type UUID ¶
type UUID []byte
UUID type is only a UUID wrapper for hprose serialize/unserialize, If you want to generate UUIDs, you should use other UUID package.
type Writer ¶
type Writer struct { Stream BufWriter // contains filtered or unexported fields }
Writer is a fine-grained operation struct for Hprose serialization
func (*Writer) WriteArray ¶
WriteArray to stream
func (*Writer) WriteBigInt ¶
WriteBigInt to stream
func (*Writer) WriteBytes ¶
WriteBytes to stream
func (*Writer) WriteBytesWithRef ¶
WriteBytesWithRef to stream
func (*Writer) WriteFloat64 ¶
WriteFloat64 to stream
func (*Writer) WriteString ¶
WriteString to stream
func (*Writer) WriteStringWithRef ¶
WriteStringWithRef to stream
func (*Writer) WriteUint64 ¶
WriteUint64 to stream