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 SearchResultPosition struct {
MsgID int
Date int
Offset int
}
const SearchResultPositionTypeID = 0x7f648b67
var (
_ bin .Encoder = &SearchResultPosition {}
_ bin .Decoder = &SearchResultPosition {}
_ bin .BareEncoder = &SearchResultPosition {}
_ bin .BareDecoder = &SearchResultPosition {}
)
func (s *SearchResultPosition ) Zero () bool {
if s == nil {
return true
}
if !(s .MsgID == 0 ) {
return false
}
if !(s .Date == 0 ) {
return false
}
if !(s .Offset == 0 ) {
return false
}
return true
}
func (s *SearchResultPosition ) String () string {
if s == nil {
return "SearchResultPosition(nil)"
}
type Alias SearchResultPosition
return fmt .Sprintf ("SearchResultPosition%+v" , Alias (*s ))
}
func (s *SearchResultPosition ) FillFrom (from interface {
GetMsgID () (value int )
GetDate () (value int )
GetOffset () (value int )
}) {
s .MsgID = from .GetMsgID ()
s .Date = from .GetDate ()
s .Offset = from .GetOffset ()
}
func (*SearchResultPosition ) TypeID () uint32 {
return SearchResultPositionTypeID
}
func (*SearchResultPosition ) TypeName () string {
return "searchResultPosition"
}
func (s *SearchResultPosition ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "searchResultPosition" ,
ID : SearchResultPositionTypeID ,
}
if s == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "MsgID" ,
SchemaName : "msg_id" ,
},
{
Name : "Date" ,
SchemaName : "date" ,
},
{
Name : "Offset" ,
SchemaName : "offset" ,
},
}
return typ
}
func (s *SearchResultPosition ) Encode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode searchResultPosition#7f648b67 as nil" )
}
b .PutID (SearchResultPositionTypeID )
return s .EncodeBare (b )
}
func (s *SearchResultPosition ) EncodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't encode searchResultPosition#7f648b67 as nil" )
}
b .PutInt (s .MsgID )
b .PutInt (s .Date )
b .PutInt (s .Offset )
return nil
}
func (s *SearchResultPosition ) Decode (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode searchResultPosition#7f648b67 to nil" )
}
if err := b .ConsumeID (SearchResultPositionTypeID ); err != nil {
return fmt .Errorf ("unable to decode searchResultPosition#7f648b67: %w" , err )
}
return s .DecodeBare (b )
}
func (s *SearchResultPosition ) DecodeBare (b *bin .Buffer ) error {
if s == nil {
return fmt .Errorf ("can't decode searchResultPosition#7f648b67 to nil" )
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode searchResultPosition#7f648b67: field msg_id: %w" , err )
}
s .MsgID = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode searchResultPosition#7f648b67: field date: %w" , err )
}
s .Date = value
}
{
value , err := b .Int ()
if err != nil {
return fmt .Errorf ("unable to decode searchResultPosition#7f648b67: field offset: %w" , err )
}
s .Offset = value
}
return nil
}
func (s *SearchResultPosition ) GetMsgID () (value int ) {
if s == nil {
return
}
return s .MsgID
}
func (s *SearchResultPosition ) GetDate () (value int ) {
if s == nil {
return
}
return s .Date
}
func (s *SearchResultPosition ) GetOffset () (value int ) {
if s == nil {
return
}
return s .Offset
}
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 .