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 TopPeer struct {
Peer PeerClass
Rating float64
}
const TopPeerTypeID = 0xedcdc05b
var (
_ bin .Encoder = &TopPeer {}
_ bin .Decoder = &TopPeer {}
_ bin .BareEncoder = &TopPeer {}
_ bin .BareDecoder = &TopPeer {}
)
func (t *TopPeer ) Zero () bool {
if t == nil {
return true
}
if !(t .Peer == nil ) {
return false
}
if !(t .Rating == 0 ) {
return false
}
return true
}
func (t *TopPeer ) String () string {
if t == nil {
return "TopPeer(nil)"
}
type Alias TopPeer
return fmt .Sprintf ("TopPeer%+v" , Alias (*t ))
}
func (t *TopPeer ) FillFrom (from interface {
GetPeer () (value PeerClass )
GetRating () (value float64 )
}) {
t .Peer = from .GetPeer ()
t .Rating = from .GetRating ()
}
func (*TopPeer ) TypeID () uint32 {
return TopPeerTypeID
}
func (*TopPeer ) TypeName () string {
return "topPeer"
}
func (t *TopPeer ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "topPeer" ,
ID : TopPeerTypeID ,
}
if t == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Peer" ,
SchemaName : "peer" ,
},
{
Name : "Rating" ,
SchemaName : "rating" ,
},
}
return typ
}
func (t *TopPeer ) Encode (b *bin .Buffer ) error {
if t == nil {
return fmt .Errorf ("can't encode topPeer#edcdc05b as nil" )
}
b .PutID (TopPeerTypeID )
return t .EncodeBare (b )
}
func (t *TopPeer ) EncodeBare (b *bin .Buffer ) error {
if t == nil {
return fmt .Errorf ("can't encode topPeer#edcdc05b as nil" )
}
if t .Peer == nil {
return fmt .Errorf ("unable to encode topPeer#edcdc05b: field peer is nil" )
}
if err := t .Peer .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode topPeer#edcdc05b: field peer: %w" , err )
}
b .PutDouble (t .Rating )
return nil
}
func (t *TopPeer ) Decode (b *bin .Buffer ) error {
if t == nil {
return fmt .Errorf ("can't decode topPeer#edcdc05b to nil" )
}
if err := b .ConsumeID (TopPeerTypeID ); err != nil {
return fmt .Errorf ("unable to decode topPeer#edcdc05b: %w" , err )
}
return t .DecodeBare (b )
}
func (t *TopPeer ) DecodeBare (b *bin .Buffer ) error {
if t == nil {
return fmt .Errorf ("can't decode topPeer#edcdc05b to nil" )
}
{
value , err := DecodePeer (b )
if err != nil {
return fmt .Errorf ("unable to decode topPeer#edcdc05b: field peer: %w" , err )
}
t .Peer = value
}
{
value , err := b .Double ()
if err != nil {
return fmt .Errorf ("unable to decode topPeer#edcdc05b: field rating: %w" , err )
}
t .Rating = value
}
return nil
}
func (t *TopPeer ) GetPeer () (value PeerClass ) {
if t == nil {
return
}
return t .Peer
}
func (t *TopPeer ) GetRating () (value float64 ) {
if t == nil {
return
}
return t .Rating
}
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 .