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 WebPageAttributeClassArray []WebPageAttributeClass
func (s WebPageAttributeClassArray ) Sort (less func (a , b WebPageAttributeClass ) bool ) WebPageAttributeClassArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s WebPageAttributeClassArray ) SortStable (less func (a , b WebPageAttributeClass ) bool ) WebPageAttributeClassArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s WebPageAttributeClassArray ) Retain (keep func (x WebPageAttributeClass ) bool ) WebPageAttributeClassArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s WebPageAttributeClassArray ) First () (v WebPageAttributeClass , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s WebPageAttributeClassArray ) Last () (v WebPageAttributeClass , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *WebPageAttributeClassArray ) PopFirst () (v WebPageAttributeClass , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero WebPageAttributeClass
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *WebPageAttributeClassArray ) Pop () (v WebPageAttributeClass , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [len (a )-1 ]
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s WebPageAttributeClassArray ) AsWebPageAttributeTheme () (to WebPageAttributeThemeArray ) {
for _ , elem := range s {
value , ok := elem .(*WebPageAttributeTheme )
if !ok {
continue
}
to = append (to , *value )
}
return to
}
func (s WebPageAttributeClassArray ) AsWebPageAttributeStory () (to WebPageAttributeStoryArray ) {
for _ , elem := range s {
value , ok := elem .(*WebPageAttributeStory )
if !ok {
continue
}
to = append (to , *value )
}
return to
}
func (s WebPageAttributeClassArray ) AsWebPageAttributeStickerSet () (to WebPageAttributeStickerSetArray ) {
for _ , elem := range s {
value , ok := elem .(*WebPageAttributeStickerSet )
if !ok {
continue
}
to = append (to , *value )
}
return to
}
func (s WebPageAttributeClassArray ) AsWebPageAttributeUniqueStarGift () (to WebPageAttributeUniqueStarGiftArray ) {
for _ , elem := range s {
value , ok := elem .(*WebPageAttributeUniqueStarGift )
if !ok {
continue
}
to = append (to , *value )
}
return to
}
func (s WebPageAttributeClassArray ) AsWebPageAttributeStarGiftCollection () (to WebPageAttributeStarGiftCollectionArray ) {
for _ , elem := range s {
value , ok := elem .(*WebPageAttributeStarGiftCollection )
if !ok {
continue
}
to = append (to , *value )
}
return to
}
func (s WebPageAttributeClassArray ) AsWebPageAttributeStarGiftAuction () (to WebPageAttributeStarGiftAuctionArray ) {
for _ , elem := range s {
value , ok := elem .(*WebPageAttributeStarGiftAuction )
if !ok {
continue
}
to = append (to , *value )
}
return to
}
func (s WebPageAttributeClassArray ) AsWebPageAttributeAiComposeTone () (to WebPageAttributeAiComposeToneArray ) {
for _ , elem := range s {
value , ok := elem .(*WebPageAttributeAiComposeTone )
if !ok {
continue
}
to = append (to , *value )
}
return to
}
type WebPageAttributeThemeArray []WebPageAttributeTheme
func (s WebPageAttributeThemeArray ) Sort (less func (a , b WebPageAttributeTheme ) bool ) WebPageAttributeThemeArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s WebPageAttributeThemeArray ) SortStable (less func (a , b WebPageAttributeTheme ) bool ) WebPageAttributeThemeArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s WebPageAttributeThemeArray ) Retain (keep func (x WebPageAttributeTheme ) bool ) WebPageAttributeThemeArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s WebPageAttributeThemeArray ) First () (v WebPageAttributeTheme , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s WebPageAttributeThemeArray ) Last () (v WebPageAttributeTheme , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *WebPageAttributeThemeArray ) PopFirst () (v WebPageAttributeTheme , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero WebPageAttributeTheme
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *WebPageAttributeThemeArray ) Pop () (v WebPageAttributeTheme , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [len (a )-1 ]
a = a [:len (a )-1 ]
*s = a
return v , true
}
type WebPageAttributeStoryArray []WebPageAttributeStory
func (s WebPageAttributeStoryArray ) Sort (less func (a , b WebPageAttributeStory ) bool ) WebPageAttributeStoryArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s WebPageAttributeStoryArray ) SortStable (less func (a , b WebPageAttributeStory ) bool ) WebPageAttributeStoryArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s WebPageAttributeStoryArray ) Retain (keep func (x WebPageAttributeStory ) bool ) WebPageAttributeStoryArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s WebPageAttributeStoryArray ) First () (v WebPageAttributeStory , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s WebPageAttributeStoryArray ) Last () (v WebPageAttributeStory , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *WebPageAttributeStoryArray ) PopFirst () (v WebPageAttributeStory , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero WebPageAttributeStory
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *WebPageAttributeStoryArray ) Pop () (v WebPageAttributeStory , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [len (a )-1 ]
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s WebPageAttributeStoryArray ) SortByID () WebPageAttributeStoryArray {
return s .Sort (func (a , b WebPageAttributeStory ) bool {
return a .GetID () < b .GetID ()
})
}
func (s WebPageAttributeStoryArray ) SortStableByID () WebPageAttributeStoryArray {
return s .SortStable (func (a , b WebPageAttributeStory ) bool {
return a .GetID () < b .GetID ()
})
}
func (s WebPageAttributeStoryArray ) FillMap (to map [int ]WebPageAttributeStory ) {
for _ , value := range s {
to [value .GetID ()] = value
}
}
func (s WebPageAttributeStoryArray ) ToMap () map [int ]WebPageAttributeStory {
r := make (map [int ]WebPageAttributeStory , len (s ))
s .FillMap (r )
return r
}
type WebPageAttributeStickerSetArray []WebPageAttributeStickerSet
func (s WebPageAttributeStickerSetArray ) Sort (less func (a , b WebPageAttributeStickerSet ) bool ) WebPageAttributeStickerSetArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s WebPageAttributeStickerSetArray ) SortStable (less func (a , b WebPageAttributeStickerSet ) bool ) WebPageAttributeStickerSetArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s WebPageAttributeStickerSetArray ) Retain (keep func (x WebPageAttributeStickerSet ) bool ) WebPageAttributeStickerSetArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s WebPageAttributeStickerSetArray ) First () (v WebPageAttributeStickerSet , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s WebPageAttributeStickerSetArray ) Last () (v WebPageAttributeStickerSet , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *WebPageAttributeStickerSetArray ) PopFirst () (v WebPageAttributeStickerSet , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero WebPageAttributeStickerSet
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *WebPageAttributeStickerSetArray ) Pop () (v WebPageAttributeStickerSet , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [len (a )-1 ]
a = a [:len (a )-1 ]
*s = a
return v , true
}
type WebPageAttributeUniqueStarGiftArray []WebPageAttributeUniqueStarGift
func (s WebPageAttributeUniqueStarGiftArray ) Sort (less func (a , b WebPageAttributeUniqueStarGift ) bool ) WebPageAttributeUniqueStarGiftArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s WebPageAttributeUniqueStarGiftArray ) SortStable (less func (a , b WebPageAttributeUniqueStarGift ) bool ) WebPageAttributeUniqueStarGiftArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s WebPageAttributeUniqueStarGiftArray ) Retain (keep func (x WebPageAttributeUniqueStarGift ) bool ) WebPageAttributeUniqueStarGiftArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s WebPageAttributeUniqueStarGiftArray ) First () (v WebPageAttributeUniqueStarGift , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s WebPageAttributeUniqueStarGiftArray ) Last () (v WebPageAttributeUniqueStarGift , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *WebPageAttributeUniqueStarGiftArray ) PopFirst () (v WebPageAttributeUniqueStarGift , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero WebPageAttributeUniqueStarGift
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *WebPageAttributeUniqueStarGiftArray ) Pop () (v WebPageAttributeUniqueStarGift , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [len (a )-1 ]
a = a [:len (a )-1 ]
*s = a
return v , true
}
type WebPageAttributeStarGiftCollectionArray []WebPageAttributeStarGiftCollection
func (s WebPageAttributeStarGiftCollectionArray ) Sort (less func (a , b WebPageAttributeStarGiftCollection ) bool ) WebPageAttributeStarGiftCollectionArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s WebPageAttributeStarGiftCollectionArray ) SortStable (less func (a , b WebPageAttributeStarGiftCollection ) bool ) WebPageAttributeStarGiftCollectionArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s WebPageAttributeStarGiftCollectionArray ) Retain (keep func (x WebPageAttributeStarGiftCollection ) bool ) WebPageAttributeStarGiftCollectionArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s WebPageAttributeStarGiftCollectionArray ) First () (v WebPageAttributeStarGiftCollection , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s WebPageAttributeStarGiftCollectionArray ) Last () (v WebPageAttributeStarGiftCollection , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *WebPageAttributeStarGiftCollectionArray ) PopFirst () (v WebPageAttributeStarGiftCollection , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero WebPageAttributeStarGiftCollection
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *WebPageAttributeStarGiftCollectionArray ) Pop () (v WebPageAttributeStarGiftCollection , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [len (a )-1 ]
a = a [:len (a )-1 ]
*s = a
return v , true
}
type WebPageAttributeStarGiftAuctionArray []WebPageAttributeStarGiftAuction
func (s WebPageAttributeStarGiftAuctionArray ) Sort (less func (a , b WebPageAttributeStarGiftAuction ) bool ) WebPageAttributeStarGiftAuctionArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s WebPageAttributeStarGiftAuctionArray ) SortStable (less func (a , b WebPageAttributeStarGiftAuction ) bool ) WebPageAttributeStarGiftAuctionArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s WebPageAttributeStarGiftAuctionArray ) Retain (keep func (x WebPageAttributeStarGiftAuction ) bool ) WebPageAttributeStarGiftAuctionArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s WebPageAttributeStarGiftAuctionArray ) First () (v WebPageAttributeStarGiftAuction , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s WebPageAttributeStarGiftAuctionArray ) Last () (v WebPageAttributeStarGiftAuction , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *WebPageAttributeStarGiftAuctionArray ) PopFirst () (v WebPageAttributeStarGiftAuction , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero WebPageAttributeStarGiftAuction
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *WebPageAttributeStarGiftAuctionArray ) Pop () (v WebPageAttributeStarGiftAuction , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [len (a )-1 ]
a = a [:len (a )-1 ]
*s = a
return v , true
}
type WebPageAttributeAiComposeToneArray []WebPageAttributeAiComposeTone
func (s WebPageAttributeAiComposeToneArray ) Sort (less func (a , b WebPageAttributeAiComposeTone ) bool ) WebPageAttributeAiComposeToneArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s WebPageAttributeAiComposeToneArray ) SortStable (less func (a , b WebPageAttributeAiComposeTone ) bool ) WebPageAttributeAiComposeToneArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s WebPageAttributeAiComposeToneArray ) Retain (keep func (x WebPageAttributeAiComposeTone ) bool ) WebPageAttributeAiComposeToneArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s WebPageAttributeAiComposeToneArray ) First () (v WebPageAttributeAiComposeTone , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s WebPageAttributeAiComposeToneArray ) Last () (v WebPageAttributeAiComposeTone , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *WebPageAttributeAiComposeToneArray ) PopFirst () (v WebPageAttributeAiComposeTone , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero WebPageAttributeAiComposeTone
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *WebPageAttributeAiComposeToneArray ) Pop () (v WebPageAttributeAiComposeTone , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [len (a )-1 ]
a = a [:len (a )-1 ]
*s = a
return v , true
}
The pages are generated with Golds v0.8.4 . (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 @zigo_101 (reachable from the left QR code) to get the latest news of Golds .