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 RecentMeURLClassArray []RecentMeURLClass
func (s RecentMeURLClassArray ) Sort (less func (a , b RecentMeURLClass ) bool ) RecentMeURLClassArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s RecentMeURLClassArray ) SortStable (less func (a , b RecentMeURLClass ) bool ) RecentMeURLClassArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s RecentMeURLClassArray ) Retain (keep func (x RecentMeURLClass ) bool ) RecentMeURLClassArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s RecentMeURLClassArray ) First () (v RecentMeURLClass , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s RecentMeURLClassArray ) Last () (v RecentMeURLClass , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *RecentMeURLClassArray ) PopFirst () (v RecentMeURLClass , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero RecentMeURLClass
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *RecentMeURLClassArray ) Pop () (v RecentMeURLClass , 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 RecentMeURLClassArray ) AsRecentMeURLUnknown () (to RecentMeURLUnknownArray ) {
for _ , elem := range s {
value , ok := elem .(*RecentMeURLUnknown )
if !ok {
continue
}
to = append (to , *value )
}
return to
}
func (s RecentMeURLClassArray ) AsRecentMeURLUser () (to RecentMeURLUserArray ) {
for _ , elem := range s {
value , ok := elem .(*RecentMeURLUser )
if !ok {
continue
}
to = append (to , *value )
}
return to
}
func (s RecentMeURLClassArray ) AsRecentMeURLChat () (to RecentMeURLChatArray ) {
for _ , elem := range s {
value , ok := elem .(*RecentMeURLChat )
if !ok {
continue
}
to = append (to , *value )
}
return to
}
func (s RecentMeURLClassArray ) AsRecentMeURLChatInvite () (to RecentMeURLChatInviteArray ) {
for _ , elem := range s {
value , ok := elem .(*RecentMeURLChatInvite )
if !ok {
continue
}
to = append (to , *value )
}
return to
}
func (s RecentMeURLClassArray ) AsRecentMeURLStickerSet () (to RecentMeURLStickerSetArray ) {
for _ , elem := range s {
value , ok := elem .(*RecentMeURLStickerSet )
if !ok {
continue
}
to = append (to , *value )
}
return to
}
type RecentMeURLUnknownArray []RecentMeURLUnknown
func (s RecentMeURLUnknownArray ) Sort (less func (a , b RecentMeURLUnknown ) bool ) RecentMeURLUnknownArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s RecentMeURLUnknownArray ) SortStable (less func (a , b RecentMeURLUnknown ) bool ) RecentMeURLUnknownArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s RecentMeURLUnknownArray ) Retain (keep func (x RecentMeURLUnknown ) bool ) RecentMeURLUnknownArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s RecentMeURLUnknownArray ) First () (v RecentMeURLUnknown , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s RecentMeURLUnknownArray ) Last () (v RecentMeURLUnknown , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *RecentMeURLUnknownArray ) PopFirst () (v RecentMeURLUnknown , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero RecentMeURLUnknown
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *RecentMeURLUnknownArray ) Pop () (v RecentMeURLUnknown , 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 RecentMeURLUserArray []RecentMeURLUser
func (s RecentMeURLUserArray ) Sort (less func (a , b RecentMeURLUser ) bool ) RecentMeURLUserArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s RecentMeURLUserArray ) SortStable (less func (a , b RecentMeURLUser ) bool ) RecentMeURLUserArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s RecentMeURLUserArray ) Retain (keep func (x RecentMeURLUser ) bool ) RecentMeURLUserArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s RecentMeURLUserArray ) First () (v RecentMeURLUser , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s RecentMeURLUserArray ) Last () (v RecentMeURLUser , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *RecentMeURLUserArray ) PopFirst () (v RecentMeURLUser , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero RecentMeURLUser
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *RecentMeURLUserArray ) Pop () (v RecentMeURLUser , 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 RecentMeURLChatArray []RecentMeURLChat
func (s RecentMeURLChatArray ) Sort (less func (a , b RecentMeURLChat ) bool ) RecentMeURLChatArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s RecentMeURLChatArray ) SortStable (less func (a , b RecentMeURLChat ) bool ) RecentMeURLChatArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s RecentMeURLChatArray ) Retain (keep func (x RecentMeURLChat ) bool ) RecentMeURLChatArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s RecentMeURLChatArray ) First () (v RecentMeURLChat , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s RecentMeURLChatArray ) Last () (v RecentMeURLChat , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *RecentMeURLChatArray ) PopFirst () (v RecentMeURLChat , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero RecentMeURLChat
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *RecentMeURLChatArray ) Pop () (v RecentMeURLChat , 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 RecentMeURLChatInviteArray []RecentMeURLChatInvite
func (s RecentMeURLChatInviteArray ) Sort (less func (a , b RecentMeURLChatInvite ) bool ) RecentMeURLChatInviteArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s RecentMeURLChatInviteArray ) SortStable (less func (a , b RecentMeURLChatInvite ) bool ) RecentMeURLChatInviteArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s RecentMeURLChatInviteArray ) Retain (keep func (x RecentMeURLChatInvite ) bool ) RecentMeURLChatInviteArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s RecentMeURLChatInviteArray ) First () (v RecentMeURLChatInvite , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s RecentMeURLChatInviteArray ) Last () (v RecentMeURLChatInvite , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *RecentMeURLChatInviteArray ) PopFirst () (v RecentMeURLChatInvite , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero RecentMeURLChatInvite
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *RecentMeURLChatInviteArray ) Pop () (v RecentMeURLChatInvite , 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 RecentMeURLStickerSetArray []RecentMeURLStickerSet
func (s RecentMeURLStickerSetArray ) Sort (less func (a , b RecentMeURLStickerSet ) bool ) RecentMeURLStickerSetArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s RecentMeURLStickerSetArray ) SortStable (less func (a , b RecentMeURLStickerSet ) bool ) RecentMeURLStickerSetArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s RecentMeURLStickerSetArray ) Retain (keep func (x RecentMeURLStickerSet ) bool ) RecentMeURLStickerSetArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s RecentMeURLStickerSetArray ) First () (v RecentMeURLStickerSet , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s RecentMeURLStickerSetArray ) Last () (v RecentMeURLStickerSet , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *RecentMeURLStickerSetArray ) PopFirst () (v RecentMeURLStickerSet , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero RecentMeURLStickerSet
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *RecentMeURLStickerSetArray ) Pop () (v RecentMeURLStickerSet , 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.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 .