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 PageTableRow struct {
Cells []PageTableCell
}
const PageTableRowTypeID = 0xe0c0c5e5
var (
_ bin .Encoder = &PageTableRow {}
_ bin .Decoder = &PageTableRow {}
_ bin .BareEncoder = &PageTableRow {}
_ bin .BareDecoder = &PageTableRow {}
)
func (p *PageTableRow ) Zero () bool {
if p == nil {
return true
}
if !(p .Cells == nil ) {
return false
}
return true
}
func (p *PageTableRow ) String () string {
if p == nil {
return "PageTableRow(nil)"
}
type Alias PageTableRow
return fmt .Sprintf ("PageTableRow%+v" , Alias (*p ))
}
func (p *PageTableRow ) FillFrom (from interface {
GetCells () (value []PageTableCell )
}) {
p .Cells = from .GetCells ()
}
func (*PageTableRow ) TypeID () uint32 {
return PageTableRowTypeID
}
func (*PageTableRow ) TypeName () string {
return "pageTableRow"
}
func (p *PageTableRow ) TypeInfo () tdp .Type {
typ := tdp .Type {
Name : "pageTableRow" ,
ID : PageTableRowTypeID ,
}
if p == nil {
typ .Null = true
return typ
}
typ .Fields = []tdp .Field {
{
Name : "Cells" ,
SchemaName : "cells" ,
},
}
return typ
}
func (p *PageTableRow ) Encode (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't encode pageTableRow#e0c0c5e5 as nil" )
}
b .PutID (PageTableRowTypeID )
return p .EncodeBare (b )
}
func (p *PageTableRow ) EncodeBare (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't encode pageTableRow#e0c0c5e5 as nil" )
}
b .PutVectorHeader (len (p .Cells ))
for idx , v := range p .Cells {
if err := v .Encode (b ); err != nil {
return fmt .Errorf ("unable to encode pageTableRow#e0c0c5e5: field cells element with index %d: %w" , idx , err )
}
}
return nil
}
func (p *PageTableRow ) Decode (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't decode pageTableRow#e0c0c5e5 to nil" )
}
if err := b .ConsumeID (PageTableRowTypeID ); err != nil {
return fmt .Errorf ("unable to decode pageTableRow#e0c0c5e5: %w" , err )
}
return p .DecodeBare (b )
}
func (p *PageTableRow ) DecodeBare (b *bin .Buffer ) error {
if p == nil {
return fmt .Errorf ("can't decode pageTableRow#e0c0c5e5 to nil" )
}
{
headerLen , err := b .VectorHeader ()
if err != nil {
return fmt .Errorf ("unable to decode pageTableRow#e0c0c5e5: field cells: %w" , err )
}
if headerLen > 0 {
p .Cells = make ([]PageTableCell , 0 , headerLen %bin .PreallocateLimit )
}
for idx := 0 ; idx < headerLen ; idx ++ {
var value PageTableCell
if err := value .Decode (b ); err != nil {
return fmt .Errorf ("unable to decode pageTableRow#e0c0c5e5: field cells: %w" , err )
}
p .Cells = append (p .Cells , value )
}
}
return nil
}
func (p *PageTableRow ) GetCells () (value []PageTableCell ) {
if p == nil {
return
}
return p .Cells
}
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 .