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 AuctionBidLevel struct {
Pos int
Amount int64
Date int
}
const AuctionBidLevelTypeID = 0x310240cc
var (
_ bin .Encoder = &AuctionBidLevel {}
_ bin .Decoder = &AuctionBidLevel {}
_ bin .BareEncoder = &AuctionBidLevel {}
_ bin .BareDecoder = &AuctionBidLevel {}
)
func (a *AuctionBidLevel ) Zero () bool {
if a == nil {
return true
}
if !(a .Pos == 0 ) {
return false
}
if !(a .Amount == 0 ) {
return false
}
if !(a .Date == 0 ) {
return false
}
return true
}
func (a *AuctionBidLevel ) String () string {
if a == nil {
return "AuctionBidLevel(nil)"
}
type Alias AuctionBidLevel
return fmt .Sprintf ("AuctionBidLevel%+v" , Alias (*a ))
}
func (a *AuctionBidLevel ) FillFrom (from interface {
GetPos () (value int )
GetAmount () (value int64 )
GetDate () (value int )
}) {
a .Pos = from .GetPos ()
a .Amount = from .GetAmount ()
a .Date = from .GetDate ()
}
func (*AuctionBidLevel ) TypeID () uint32 {
return AuctionBidLevelTypeID
}
func (*AuctionBidLevel ) TypeName () string {
return "auctionBidLevel"
}
func (a *AuctionBidLevel ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "auctionBidLevel" ,
ID : AuctionBidLevelTypeID ,
}
if a == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Pos" ,
SchemaName : "pos" ,
},
{
Name : "Amount" ,
SchemaName : "amount" ,
},
{
Name : "Date" ,
SchemaName : "date" ,
},
}
return typ
}
func (a *AuctionBidLevel ) Encode (b *bin .Buffer ) error {
if a == nil {
return fmt .Errorf ("can't encode auctionBidLevel#310240cc as nil" )
}
b .PutID (AuctionBidLevelTypeID )
return a .EncodeBare (b )
}
func (a *AuctionBidLevel ) EncodeBare (b *bin .Buffer ) error {
if a == nil {
return fmt .Errorf ("can't encode auctionBidLevel#310240cc as nil" )
}
b .PutInt (a .Pos )
b .PutLong (a .Amount )
b .PutInt (a .Date )
return nil
}
func (a *AuctionBidLevel ) Decode (b *bin .Buffer ) error {
if a == nil {
return fmt .Errorf ("can't decode auctionBidLevel#310240cc to nil" )
}
if err := b .ConsumeID (AuctionBidLevelTypeID ); err != nil {
return fmt .Errorf ("unable to decode auctionBidLevel#310240cc: %w" , err )
}
return a .DecodeBare (b )
}
func (a *AuctionBidLevel ) DecodeBare (b *bin .Buffer ) error {
if a == nil {
return fmt .Errorf ("can't decode auctionBidLevel#310240cc to nil" )
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode auctionBidLevel#310240cc: field pos: %w" , err )
}
a .Pos = value
}
{
value , err := b .Long ()
if err != nil {
return fmt .Errorf ("unable to decode auctionBidLevel#310240cc: field amount: %w" , err )
}
a .Amount = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode auctionBidLevel#310240cc: field date: %w" , err )
}
a .Date = value
}
return nil
}
func (a *AuctionBidLevel ) GetPos () (value int ) {
if a == nil {
return
}
return a .Pos
}
func (a *AuctionBidLevel ) GetAmount () (value int64 ) {
if a == nil {
return
}
return a .Amount
}
func (a *AuctionBidLevel ) GetDate () (value int ) {
if a == nil {
return
}
return a .Date
}
The pages are generated with Golds v0.8.4 . (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 @zigo_101 (reachable from the left QR code) to get the latest news of Golds .