Documentation ¶
Index ¶
- Constants
- Variables
- func Append(dst, src []byte) []byte
- func Decode(data []byte, sp interface{}) (int, error)
- func DecodePacked(data []byte, sp interface{}) error
- func Encode(sp interface{}) ([]byte, error)
- func EncodePacked(sp interface{}) ([]byte, error)
- func EnumName(m map[int32]string, v int32) string
- func Pack(src []byte) []byte
- func Unpack(src []byte) ([]byte, error)
- type SprotoField
- type SprotoType
- type Tag
Constants ¶
View Source
const ( EncodeBufferSize = 4096 MaxEmbeddedInt = 0x7fff - 1 MaxInt32 = 0x7fffffff MinInt32 = -0x80000000 )
View Source
const ( WireVarintName = "integer" // int, uint, int8, uint8, int16, uint16, int32, uint32, int64, uint64 WireBooleanName = "boolean" // bool WireBytesName = "string" // string, []byte WireStructName = "struct" // struct )
Variables ¶
View Source
var ( ErrNonPtr = errors.New("sproto: called with Non-Ptr type") ErrNonStruct = errors.New("sproto: Encode called with Non-Ptr") ErrNil = errors.New("sproto: Encode called with nil") ErrDecode = errors.New("sproto: Decode msg failed") ErrUnpack = errors.New("sproto: Unpack data failed") )
Functions ¶
Types ¶
type SprotoField ¶
type SprotoType ¶
type SprotoType struct { Name string // struct name Fields []*SprotoField // contains filtered or unexported fields }
func GetSprotoType ¶
func GetSprotoType(t reflect.Type) (*SprotoType, error)
func (*SprotoType) FieldByTag ¶
func (st *SprotoType) FieldByTag(tag int) *SprotoField
func (*SprotoType) Len ¶
func (st *SprotoType) Len() int
func (*SprotoType) Less ¶
func (st *SprotoType) Less(i, j int) bool
func (*SprotoType) Swap ¶
func (st *SprotoType) Swap(i, j int)
Click to show internal directories.
Click to hide internal directories.