Documentation ¶
Overview ¶
Package tdjson contains some helpers to use jx with TL objects.
Index ¶
- Constants
- Variables
- func NewUnexpectedID(id string) error
- type Decoder
- func (b Decoder) Arr(cb func(d Decoder) error) error
- func (b Decoder) Bool() (bool, error)
- func (b Decoder) Bytes() ([]byte, error)
- func (b Decoder) ConsumeID(id string) error
- func (b Decoder) Double() (float64, error)
- func (b Decoder) FindTypeID() (string, error)
- func (b Decoder) ID() (string, error)
- func (b Decoder) Int() (int, error)
- func (b Decoder) Int128() (bin.Int128, error)
- func (b Decoder) Int256() (bin.Int256, error)
- func (b Decoder) Int32() (int32, error)
- func (b Decoder) Int53() (int64, error)
- func (b Decoder) Long() (int64, error)
- func (b Decoder) Obj(cb func(d Decoder, key []byte) error) error
- func (b Decoder) String() (string, error)
- func (b Decoder) Uint16() (uint16, error)
- func (b Decoder) Uint32() (uint32, error)
- func (b Decoder) Uint64() (uint64, error)
- type Encoder
- func (b Encoder) PutBool(v bool)
- func (b Encoder) PutBytes(v []byte)
- func (b Encoder) PutDouble(v float64)
- func (b Encoder) PutID(typeID string)
- func (b Encoder) PutInt(v int)
- func (b Encoder) PutInt128(v bin.Int128)
- func (b Encoder) PutInt256(v bin.Int256)
- func (b Encoder) PutInt32(v int32)
- func (b Encoder) PutInt53(v int64)
- func (b Encoder) PutLong(v int64)
- func (b Encoder) PutString(s string)
- func (b Encoder) PutUint16(v uint16)
- func (b Encoder) PutUint32(v uint32)
- func (b Encoder) PutUint64(v uint64)
- func (b Encoder) StripComma()
- type TDLibDecoder
- type TDLibEncoder
- type UnexpectedIDError
Constants ¶
const TypeField = "@type"
TypeField is a type field name.
Variables ¶
var ErrTypeIDNotFound = errors.New("@type field is expected, but not found")
ErrTypeIDNotFound means that @type field is expected, but not found.
Functions ¶
func NewUnexpectedID ¶
NewUnexpectedID return new UnexpectedIDError.
Types ¶
type Decoder ¶
Decoder is a simple wrapper around jx.Decoder to conform TL type system.
func (Decoder) FindTypeID ¶
FindTypeID tries to find @type field or returns error.
func (Decoder) Obj ¶
Obj calls f for every key in object, using byte slice as key.
The key value is valid only until f is not returned.
type Encoder ¶
Encoder is a simple wrapper around jx.Encoder to conform TL type system.
func (Encoder) StripComma ¶
func (b Encoder) StripComma()
StripComma deletes last comma, if any.
Useful for code generation to avoid last field/element tracking.
type TDLibDecoder ¶
TDLibDecoder represents TDLib JSON API decoder.
type TDLibEncoder ¶
TDLibEncoder represents TDLib JSON API encoder.
type UnexpectedIDError ¶
type UnexpectedIDError struct {
ID string
}
UnexpectedIDError means that unknown or unexpected type id was decoded.
func (*UnexpectedIDError) Error ¶
func (e *UnexpectedIDError) Error() string