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 MessageRange struct {
MinID int
MaxID int
}
const MessageRangeTypeID = 0xae30253
var (
_ bin .Encoder = &MessageRange {}
_ bin .Decoder = &MessageRange {}
_ bin .BareEncoder = &MessageRange {}
_ bin .BareDecoder = &MessageRange {}
)
func (m *MessageRange ) Zero () bool {
if m == nil {
return true
}
if !(m .MinID == 0 ) {
return false
}
if !(m .MaxID == 0 ) {
return false
}
return true
}
func (m *MessageRange ) String () string {
if m == nil {
return "MessageRange(nil)"
}
type Alias MessageRange
return fmt .Sprintf ("MessageRange%+v" , Alias (*m ))
}
func (m *MessageRange ) FillFrom (from interface {
GetMinID () (value int )
GetMaxID () (value int )
}) {
m .MinID = from .GetMinID ()
m .MaxID = from .GetMaxID ()
}
func (*MessageRange ) TypeID () uint32 {
return MessageRangeTypeID
}
func (*MessageRange ) TypeName () string {
return "messageRange"
}
func (m *MessageRange ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "messageRange" ,
ID : MessageRangeTypeID ,
}
if m == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "MinID" ,
SchemaName : "min_id" ,
},
{
Name : "MaxID" ,
SchemaName : "max_id" ,
},
}
return typ
}
func (m *MessageRange ) Encode (b *bin .Buffer ) error {
if m == nil {
return fmt .Errorf ("can't encode messageRange#ae30253 as nil" )
}
b .PutID (MessageRangeTypeID )
return m .EncodeBare (b )
}
func (m *MessageRange ) EncodeBare (b *bin .Buffer ) error {
if m == nil {
return fmt .Errorf ("can't encode messageRange#ae30253 as nil" )
}
b .PutInt (m .MinID )
b .PutInt (m .MaxID )
return nil
}
func (m *MessageRange ) Decode (b *bin .Buffer ) error {
if m == nil {
return fmt .Errorf ("can't decode messageRange#ae30253 to nil" )
}
if err := b .ConsumeID (MessageRangeTypeID ); err != nil {
return fmt .Errorf ("unable to decode messageRange#ae30253: %w" , err )
}
return m .DecodeBare (b )
}
func (m *MessageRange ) DecodeBare (b *bin .Buffer ) error {
if m == nil {
return fmt .Errorf ("can't decode messageRange#ae30253 to nil" )
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode messageRange#ae30253: field min_id: %w" , err )
}
m .MinID = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode messageRange#ae30253: field max_id: %w" , err )
}
m .MaxID = value
}
return nil
}
func (m *MessageRange ) GetMinID () (value int ) {
if m == nil {
return
}
return m .MinID
}
func (m *MessageRange ) GetMaxID () (value int ) {
if m == nil {
return
}
return m .MaxID
}
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 .