package tdjson

Import Path
	github.com/gotd/td/tdjson (on go.dev)

Dependency Relation
	imports 7 packages, and imported by 2 packages

Involved Source Files decoder.go encoder.go errors.go obj.go Package tdjson contains some helpers to use jx with TL objects.
Package-Level Type Names (total 5, all are exported)
/* sort exporteds by: | */
Decoder is a simple wrapper around jx.Decoder to conform TL type system. Decoder *jx.Decoder Arr decodes array and invokes callback on each array element. ArrIter creates new array iterator. Base64 decodes base64 encoded data from string. Same as encoding/json, base64.StdEncoding or RFC 4648. Base64Append appends base64 encoded data from string. Same as encoding/json, base64.StdEncoding or RFC 4648. BigFloat read big.Float BigInt read big.Int Bool deserializes boolean. Bytes deserializes bare byte string. Capture calls f and then rolls back to state before call. ConsumeID deserializes given typeID. Double deserializes 64-bit floating point. Elem skips to the start of next array element, returning true boolean if element exists. Can be called before or in Array. FindTypeID tries to find @type field or returns error. Float32 reads float32 value. Float64 read float64 ID deserializes given typeID. Int deserializes signed 32-bit integer. Int128 deserializes 128-bit signed integer. Int16 reads int16. Int256 deserializes 256-bit signed integer. Int32 deserializes signed 32-bit integer. Int53 deserializes int53. Int64 reads int64. Int8 reads int8. Long deserializes int64. Next gets Type of relatively next json element Null reads a json object as null and returns whether it's a null or not. Num decodes number. Do not retain returned value, it references underlying buffer. NumAppend appends number. Obj calls f for every key in object, using byte slice as key. The key value is valid only until f is not returned. ObjBytes calls f for every key in object, using byte slice as key. The key value is valid only until f is not returned. ObjIter creates new object iterator. Raw is like Skip(), but saves and returns skipped value as raw json. Do not retain returned value, it references underlying buffer. RawAppend is Raw that appends saved raw json value to buf. Reset resets reader and underlying state, next reads will use provided io.Reader. ResetBytes resets underlying state, next reads will use provided buffer. Skip skips a json object and positions to relatively the next json object. Str reads string. StrAppend reads string and appends it to byte slice. StrBytes returns string value as sub-slice of internal buffer. Bytes are valid only until next call to any Decoder method. String deserializes bare string. UInt reads uint. UInt16 reads uint16. UInt32 reads uint32. UInt64 reads uint64. UInt8 reads uint8. Uint16 deserializes unsigned 16-bit integer. Uint32 deserializes unsigned 32-bit integer. Uint64 deserializes unsigned 64-bit integer. Validate consumes all input, validating that input is a json object without any trialing data. func TDLibDecoder.DecodeTDLibJSON(Decoder) error
Encoder is a simple wrapper around jx.Encoder to conform TL type system. Writer *jx.Writer // underlying buffer ArrEnd writes end of array. ArrStart writes start of array. Base64 encodes data as standard base64 encoded string. Same as encoding/json, base64.StdEncoding or RFC 4648. Bool encodes boolean. ByteStr encodes string without html escaping. Use ByteStrEscape to escape html, this is default for encoding/json and should be used by default for untrusted strings. ByteStrEscape encodes string with html special characters escaping. Close flushes underlying buffer to writer in streaming mode. Otherwise, it does nothing. Comma writes comma. False writes false. FieldStart encodes field name and writes colon. Float writes float value to buffer. Float32 encodes float32. NB: Infinities and NaN are represented as null. Float64 encodes float64. NB: Infinities and NaN are represented as null. Grow grows the underlying buffer. Calls (*bytes.Buffer).Grow(n int) on w.Buf. Int encodes int. Int16 encodes int16. Int32 encodes int32. Int64 encodes int64. Int8 encodes int8. Null writes null. Num encodes number. ObjEnd writes end of object token. ObjStart writes object start. PutBool serializes boolean. PutBytes serializes bare byte string. PutDouble serializes v as 64-bit floating point. PutID serializes given typeID. PutInt serializes v as signed 32-bit integer. PutInt128 serializes v as 128-bit signed integer. PutInt256 serializes v as 256-bit signed integer. PutInt32 serializes signed 32-bit integer. PutInt53 serializes v as int53. PutLong serializes v as int64. PutString serializes bare string. PutUint16 serializes unsigned 16-bit integer. PutUint32 serializes unsigned 32-bit integer. PutUint64 serializes v as unsigned 64-bit integer. Raw writes byte slice as raw json. RawStr writes string as raw json. Reset resets underlying buffer. If w is in streaming mode, it is reset to non-streaming mode. ResetWriter resets underlying buffer and sets output writer. Str encodes string without html escaping. Use StrEscape to escape html, this is default for encoding/json and should be used by default for untrusted strings. StrEscape encodes string with html special characters escaping. String returns string of underlying buffer. StripComma deletes last comma, if any. Useful for code generation to avoid last field/element tracking. True writes true. UInt encodes uint. UInt16 encodes uint16. UInt32 encodes uint32. UInt64 encodes uint64. UInt8 encodes uint8. Write implements io.Writer. WriteTo implements io.WriterTo. Encoder : fmt.Stringer Encoder : internal/bisect.Writer Encoder : io.Closer Encoder : io.WriteCloser Encoder : io.Writer Encoder : io.WriterTo func TDLibEncoder.EncodeTDLibJSON(Encoder) error
TDLibDecoder represents TDLib JSON API decoder. ( TDLibDecoder) DecodeTDLibJSON(Decoder) error
TDLibEncoder represents TDLib JSON API encoder. ( TDLibEncoder) EncodeTDLibJSON(Encoder) error
UnexpectedIDError means that unknown or unexpected type id was decoded. ID string (*UnexpectedIDError) Error() string *UnexpectedIDError : error
Package-Level Functions (only one, which is exported)
NewUnexpectedID return new UnexpectedIDError.
Package-Level Variables (only one, which is exported)
ErrTypeIDNotFound means that @type field is expected, but not found.
Package-Level Constants (only one, which is exported)
TypeField is a type field name.