Source File
tl_ping_gen.go
Belonging Package
github.com/gotd/td/internal/mt
// Code generated by gotdgen, DO NOT EDIT.
package mt
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{}
)
// PingRequest represents TL type `ping#7abe77ec`.
type PingRequest struct {
// PingID field of PingRequest.
PingID int64
}
// PingRequestTypeID is TL type id of PingRequest.
const PingRequestTypeID = 0x7abe77ec
// Ensuring interfaces in compile-time for PingRequest.
var (
_ bin.Encoder = &PingRequest{}
_ bin.Decoder = &PingRequest{}
_ bin.BareEncoder = &PingRequest{}
_ bin.BareDecoder = &PingRequest{}
)
func ( *PingRequest) () bool {
if == nil {
return true
}
if !(.PingID == 0) {
return false
}
return true
}
// String implements fmt.Stringer.
func ( *PingRequest) () string {
if == nil {
return "PingRequest(nil)"
}
type PingRequest
return fmt.Sprintf("PingRequest%+v", (*))
}
// TypeID returns type id in TL schema.
//
// See https://core.telegram.org/mtproto/TL-tl#remarks.
func (*PingRequest) () uint32 {
return PingRequestTypeID
}
// TypeName returns name of type in TL schema.
func (*PingRequest) () string {
return "ping"
}
// TypeInfo returns info about TL type.
func ( *PingRequest) () tdp.Type {
:= tdp.Type{
Name: "ping",
ID: PingRequestTypeID,
}
if == nil {
.Null = true
return
}
.Fields = []tdp.Field{
{
Name: "PingID",
SchemaName: "ping_id",
},
}
return
}
// Encode implements bin.Encoder.
func ( *PingRequest) ( *bin.Buffer) error {
if == nil {
return fmt.Errorf("can't encode ping#7abe77ec as nil")
}
.PutID(PingRequestTypeID)
return .EncodeBare()
}
// EncodeBare implements bin.BareEncoder.
func ( *PingRequest) ( *bin.Buffer) error {
if == nil {
return fmt.Errorf("can't encode ping#7abe77ec as nil")
}
.PutLong(.PingID)
return nil
}
// Decode implements bin.Decoder.
func ( *PingRequest) ( *bin.Buffer) error {
if == nil {
return fmt.Errorf("can't decode ping#7abe77ec to nil")
}
if := .ConsumeID(PingRequestTypeID); != nil {
return fmt.Errorf("unable to decode ping#7abe77ec: %w", )
}
return .DecodeBare()
}
// DecodeBare implements bin.BareDecoder.
func ( *PingRequest) ( *bin.Buffer) error {
if == nil {
return fmt.Errorf("can't decode ping#7abe77ec to nil")
}
{
, := .Long()
if != nil {
return fmt.Errorf("unable to decode ping#7abe77ec: field ping_id: %w", )
}
.PingID =
}
return nil
}
// GetPingID returns value of PingID field.
func ( *PingRequest) () ( int64) {
if == nil {
return
}
return .PingID
}
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. |