package tg
import (
"context"
"errors"
"fmt"
"sort"
"strings"
"go.uber.org/multierr"
"github.com/gotd/td/bin"
"github.com/gotd/td/tdjson"
"github.com/gotd/td/tdp"
"github.com/gotd/td/tgerr"
)
var (
_ = bin .Buffer {}
_ = context .Background ()
_ = fmt .Stringer (nil )
_ = strings .Builder {}
_ = errors .Is
_ = multierr .AppendInto
_ = sort .Ints
_ = tdp .Format
_ = tgerr .Error {}
_ = tdjson .Encoder {}
)
type NearestDC struct {
Country string
ThisDC int
NearestDC int
}
const NearestDCTypeID = 0x8e1a1775
var (
_ bin .Encoder = &NearestDC {}
_ bin .Decoder = &NearestDC {}
_ bin .BareEncoder = &NearestDC {}
_ bin .BareDecoder = &NearestDC {}
)
func (n *NearestDC ) Zero () bool {
if n == nil {
return true
}
if !(n .Country == "" ) {
return false
}
if !(n .ThisDC == 0 ) {
return false
}
if !(n .NearestDC == 0 ) {
return false
}
return true
}
func (n *NearestDC ) String () string {
if n == nil {
return "NearestDC(nil)"
}
type Alias NearestDC
return fmt .Sprintf ("NearestDC%+v" , Alias (*n ))
}
func (n *NearestDC ) FillFrom (from interface {
GetCountry () (value string )
GetThisDC () (value int )
GetNearestDC () (value int )
}) {
n .Country = from .GetCountry ()
n .ThisDC = from .GetThisDC ()
n .NearestDC = from .GetNearestDC ()
}
func (*NearestDC ) TypeID () uint32 {
return NearestDCTypeID
}
func (*NearestDC ) TypeName () string {
return "nearestDc"
}
func (n *NearestDC ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "nearestDc" ,
ID : NearestDCTypeID ,
}
if n == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Country" ,
SchemaName : "country" ,
},
{
Name : "ThisDC" ,
SchemaName : "this_dc" ,
},
{
Name : "NearestDC" ,
SchemaName : "nearest_dc" ,
},
}
return typ
}
func (n *NearestDC ) Encode (b *bin .Buffer ) error {
if n == nil {
return fmt .Errorf ("can't encode nearestDc#8e1a1775 as nil" )
}
b .PutID (NearestDCTypeID )
return n .EncodeBare (b )
}
func (n *NearestDC ) EncodeBare (b *bin .Buffer ) error {
if n == nil {
return fmt .Errorf ("can't encode nearestDc#8e1a1775 as nil" )
}
b .PutString (n .Country )
b .PutInt (n .ThisDC )
b .PutInt (n .NearestDC )
return nil
}
func (n *NearestDC ) Decode (b *bin .Buffer ) error {
if n == nil {
return fmt .Errorf ("can't decode nearestDc#8e1a1775 to nil" )
}
if err := b .ConsumeID (NearestDCTypeID ); err != nil {
return fmt .Errorf ("unable to decode nearestDc#8e1a1775: %w" , err )
}
return n .DecodeBare (b )
}
func (n *NearestDC ) DecodeBare (b *bin .Buffer ) error {
if n == nil {
return fmt .Errorf ("can't decode nearestDc#8e1a1775 to nil" )
}
{
value , err := b .String ()
if err != nil {
return fmt .Errorf ("unable to decode nearestDc#8e1a1775: field country: %w" , err )
}
n .Country = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode nearestDc#8e1a1775: field this_dc: %w" , err )
}
n .ThisDC = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode nearestDc#8e1a1775: field nearest_dc: %w" , err )
}
n .NearestDC = value
}
return nil
}
func (n *NearestDC ) GetCountry () (value string ) {
if n == nil {
return
}
return n .Country
}
func (n *NearestDC ) GetThisDC () (value int ) {
if n == nil {
return
}
return n .ThisDC
}
func (n *NearestDC ) GetNearestDC () (value int ) {
if n == nil {
return
}
return n .NearestDC
}
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 .