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