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 StatsAbsValueAndPrev struct {
Current float64
Previous float64
}
const StatsAbsValueAndPrevTypeID = 0xcb43acde
var (
_ bin .Encoder = &StatsAbsValueAndPrev {}
_ bin .Decoder = &StatsAbsValueAndPrev {}
_ bin .BareEncoder = &StatsAbsValueAndPrev {}
_ bin .BareDecoder = &StatsAbsValueAndPrev {}
)
func (s *StatsAbsValueAndPrev ) Zero () bool {
if s == nil {
return true
}
if !(s .Current == 0 ) {
return false
}
if !(s .Previous == 0 ) {
return false
}
return true
}
func (s *StatsAbsValueAndPrev ) String () string {
if s == nil {
return "StatsAbsValueAndPrev(nil)"
}
type Alias StatsAbsValueAndPrev
return fmt .Sprintf ("StatsAbsValueAndPrev%+v" , Alias (*s ))
}
func (s *StatsAbsValueAndPrev ) FillFrom (from interface {
GetCurrent () (value float64 )
GetPrevious () (value float64 )
}) {
s .Current = from .GetCurrent ()
s .Previous = from .GetPrevious ()
}
func (*StatsAbsValueAndPrev ) TypeID () uint32 {
return StatsAbsValueAndPrevTypeID
}
func (*StatsAbsValueAndPrev ) TypeName () string {
return "statsAbsValueAndPrev"
}
func (s *StatsAbsValueAndPrev ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "statsAbsValueAndPrev" ,
ID : StatsAbsValueAndPrevTypeID ,
}
if s == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Current" ,
SchemaName : "current" ,
},
{
Name : "Previous" ,
SchemaName : "previous" ,
},
}
return typ
}
func (s *StatsAbsValueAndPrev ) Encode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode statsAbsValueAndPrev#cb43acde as nil" )
}
b .PutID (StatsAbsValueAndPrevTypeID )
return s .EncodeBare (b )
}
func (s *StatsAbsValueAndPrev ) EncodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode statsAbsValueAndPrev#cb43acde as nil" )
}
b .PutDouble (s .Current )
b .PutDouble (s .Previous )
return nil
}
func (s *StatsAbsValueAndPrev ) Decode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode statsAbsValueAndPrev#cb43acde to nil" )
}
if err := b .ConsumeID (StatsAbsValueAndPrevTypeID ); err != nil {
return fmt .Errorf ("unable to decode statsAbsValueAndPrev#cb43acde: %w" , err )
}
return s .DecodeBare (b )
}
func (s *StatsAbsValueAndPrev ) DecodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode statsAbsValueAndPrev#cb43acde to nil" )
}
{
value , err := b .Double ()
if err != nil {
return fmt .Errorf ("unable to decode statsAbsValueAndPrev#cb43acde: field current: %w" , err )
}
s .Current = value
}
{
value , err := b .Double ()
if err != nil {
return fmt .Errorf ("unable to decode statsAbsValueAndPrev#cb43acde: field previous: %w" , err )
}
s .Previous = value
}
return nil
}
func (s *StatsAbsValueAndPrev ) GetCurrent () (value float64 ) {
if s == nil {
return
}
return s .Current
}
func (s *StatsAbsValueAndPrev ) GetPrevious () (value float64 ) {
if s == nil {
return
}
return s .Previous
}
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 .