Documentation ¶
Index ¶
- Constants
- Variables
- func CalcCrc32(line string) uint32
- type Decoder
- func (d *Decoder) Bool() bool
- func (d *Decoder) Bytes(size int) []byte
- func (d *Decoder) Decode() *TLObject
- func (d *Decoder) Double() float64
- func (d *Decoder) Error() error
- func (d *Decoder) GetOffset() int
- func (d *Decoder) GetSize() int
- func (d *Decoder) Int() int32
- func (d *Decoder) Long() int64
- func (d *Decoder) SetError(err error)
- func (d *Decoder) String() string
- func (d *Decoder) UInt() uint32
- func (d *Decoder) VectorBytes() [][]byte
- func (d *Decoder) VectorDecode() []*TLObject
- func (d *Decoder) VectorDouble() []float64
- func (d *Decoder) VectorInt() []int32
- func (d *Decoder) VectorLong() []int64
- func (d *Decoder) VectorString() []string
- type Encoder
- func (e *Encoder) Bytes(s []byte)
- func (e *Encoder) BytesVector(v [][]byte)
- func (e *Encoder) Double(v float64)
- func (e *Encoder) Encode(line string, values any) ([]byte, error)
- func (e *Encoder) Int(v int32)
- func (e *Encoder) IntVector(v []int32)
- func (e *Encoder) Long(v int64)
- func (e *Encoder) LongVector(v []int64)
- func (e *Encoder) String(v string)
- func (e *Encoder) StringVector(v []string)
- func (e *Encoder) UInt(v uint32)
- func (e *Encoder) VectorDouble(v []float64)
- func (e *Encoder) VectorFlag(length uint32)
- type Optional
- type SubType
- type TLObject
- func (o *TLObject) GetBool(key string) bool
- func (o *TLObject) GetBytes(key string) []byte
- func (o *TLObject) GetBytesSlice(key string) [][]byte
- func (o *TLObject) GetFloat64(key string) (float64, bool)
- func (o *TLObject) GetFloat64Slice(key string) []float64
- func (o *TLObject) GetInt32(key string) (int32, bool)
- func (o *TLObject) GetInt32Slice(key string) []int32
- func (o *TLObject) GetInt64(key string) (int64, bool)
- func (o *TLObject) GetInt64Slice(key string) []int64
- func (o *TLObject) GetString(key string) (string, bool)
- func (o *TLObject) GetStringSlice(key string) []string
- func (o *TLObject) GetTLObject(key string) (*TLObject, bool)
- func (o *TLObject) GetTLObjectSlice(key string) []*TLObject
- func (o *TLObject) GetUInt32(key string) (uint32, bool)
- func (o *TLObject) GetUInt32Slice(key string) []uint32
- func (o *TLObject) GetUInt64(key string) (uint64, bool)
- func (o *TLObject) GetUInt64Slice(key string) []uint64
- type TLSubType
- type Type
- type TypeParam
Constants ¶
View Source
const ( VectorCrc32Hex = "1cb5c415" VectorCrc32 = 0x1cb5c415 // 481674261 BoolFalseCrc32Hex = "bc799737" BoolFalseCrc32 = 0xbc799737 // 3161706375 BoolTrueCrc32Hex = "997275b5" BoolTrueCrc32 = 0x997275b5 // 2574592005 )
Variables ¶
View Source
var ( ErrLayerNotFound = fmt.Errorf("layer not found") ErrCrc32HexNotFound = fmt.Errorf("crc32Hex not found") ErrTypeNameNotFound = fmt.Errorf("typeName not found") ErrInputTypeNotTLSubType = fmt.Errorf("input type not TLSubType") ErrInputTypeNil = fmt.Errorf("input type is nil") DecodeErrDataTooShort = fmt.Errorf("decode: data too short") DecodeErrCrc32HexNotMatch = fmt.Errorf("decode: crc32Hex not match") DecodeErrUnknownVectorSize = fmt.Errorf("decode: unknown vector size") )
View Source
var SubTypeCrc32Map = make(map[int32]map[string]string) // layer -> typeName -> crc32Hex
View Source
var SubTypeMap = make(map[int32]map[string]*SubType) // layer -> crc32Hex -> SubType
View Source
var TypeMap = make(map[int32]map[string]*Type) // layer -> typeName -> Type
Functions ¶
Types ¶
type Decoder ¶
type Decoder struct { Layer int32 // contains filtered or unexported fields }
func NewDecoder ¶
func (*Decoder) VectorBytes ¶
func (*Decoder) VectorDecode ¶
func (*Decoder) VectorDouble ¶
func (*Decoder) VectorLong ¶
func (*Decoder) VectorString ¶
type Encoder ¶
type Encoder struct { Layer int32 // contains filtered or unexported fields }
func NewEncoder ¶
func (*Encoder) BytesVector ¶
func (*Encoder) Encode ¶
Encode 编码 layer: 层级 line: 一行,或crc32Hex Values: 参数,可以是[]any,也可以是map[string]any
func (*Encoder) LongVector ¶
func (*Encoder) StringVector ¶
func (*Encoder) VectorDouble ¶
func (*Encoder) VectorFlag ¶
type TLObject ¶
func (*TLObject) GetBytesSlice ¶
func (*TLObject) GetFloat64Slice ¶
func (*TLObject) GetInt32Slice ¶
func (*TLObject) GetInt64Slice ¶
func (*TLObject) GetStringSlice ¶
func (*TLObject) GetTLObjectSlice ¶
func (*TLObject) GetUInt32Slice ¶
func (*TLObject) GetUInt64Slice ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.