Source File
tl_data_json_gen.go
Belonging Package
github.com/gotd/td/tg
// Code generated by gotdgen, DO NOT EDIT.
package tg
import (
)
// No-op definition for keeping imports.
var (
_ = bin.Buffer{}
_ = context.Background()
_ = fmt.Stringer(nil)
_ = strings.Builder{}
_ = errors.Is
_ = multierr.AppendInto
_ = sort.Ints
_ = tdp.Format
_ = tgerr.Error{}
_ = tdjson.Encoder{}
)
// DataJSON represents TL type `dataJSON#7d748d04`.
// Represents a json-encoded object
//
// See https://core.telegram.org/constructor/dataJSON for reference.
type DataJSON struct {
// JSON-encoded object
Data string
}
// DataJSONTypeID is TL type id of DataJSON.
const DataJSONTypeID = 0x7d748d04
// Ensuring interfaces in compile-time for DataJSON.
var (
_ bin.Encoder = &DataJSON{}
_ bin.Decoder = &DataJSON{}
_ bin.BareEncoder = &DataJSON{}
_ bin.BareDecoder = &DataJSON{}
)
func ( *DataJSON) () bool {
if == nil {
return true
}
if !(.Data == "") {
return false
}
return true
}
// String implements fmt.Stringer.
func ( *DataJSON) () string {
if == nil {
return "DataJSON(nil)"
}
type DataJSON
return fmt.Sprintf("DataJSON%+v", (*))
}
// FillFrom fills DataJSON from given interface.
func ( *DataJSON) ( interface {
() ( string)
}) {
.Data = .()
}
// TypeID returns type id in TL schema.
//
// See https://core.telegram.org/mtproto/TL-tl#remarks.
func (*DataJSON) () uint32 {
return DataJSONTypeID
}
// TypeName returns name of type in TL schema.
func (*DataJSON) () string {
return "dataJSON"
}
// TypeInfo returns info about TL type.
func ( *DataJSON) () tdp.Type {
:= tdp.Type{
Name: "dataJSON",
ID: DataJSONTypeID,
}
if == nil {
.Null = true
return
}
.Fields = []tdp.Field{
{
Name: "Data",
SchemaName: "data",
},
}
return
}
// Encode implements bin.Encoder.
func ( *DataJSON) ( *bin.Buffer) error {
if == nil {
return fmt.Errorf("can't encode dataJSON#7d748d04 as nil")
}
.PutID(DataJSONTypeID)
return .EncodeBare()
}
// EncodeBare implements bin.BareEncoder.
func ( *DataJSON) ( *bin.Buffer) error {
if == nil {
return fmt.Errorf("can't encode dataJSON#7d748d04 as nil")
}
.PutString(.Data)
return nil
}
// Decode implements bin.Decoder.
func ( *DataJSON) ( *bin.Buffer) error {
if == nil {
return fmt.Errorf("can't decode dataJSON#7d748d04 to nil")
}
if := .ConsumeID(DataJSONTypeID); != nil {
return fmt.Errorf("unable to decode dataJSON#7d748d04: %w", )
}
return .DecodeBare()
}
// DecodeBare implements bin.BareDecoder.
func ( *DataJSON) ( *bin.Buffer) error {
if == nil {
return fmt.Errorf("can't decode dataJSON#7d748d04 to nil")
}
{
, := .String()
if != nil {
return fmt.Errorf("unable to decode dataJSON#7d748d04: field data: %w", )
}
.Data =
}
return nil
}
// GetData returns value of Data field.
func ( *DataJSON) () ( string) {
if == nil {
return
}
return .Data
}
The pages are generated with Golds v0.6.7. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |