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 ChannelParticipantClassArray []ChannelParticipantClass
func (s ChannelParticipantClassArray ) Sort (less func (a , b ChannelParticipantClass ) bool ) ChannelParticipantClassArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s ChannelParticipantClassArray ) SortStable (less func (a , b ChannelParticipantClass ) bool ) ChannelParticipantClassArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s ChannelParticipantClassArray ) Retain (keep func (x ChannelParticipantClass ) bool ) ChannelParticipantClassArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s ChannelParticipantClassArray ) First () (v ChannelParticipantClass , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s ChannelParticipantClassArray ) Last () (v ChannelParticipantClass , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *ChannelParticipantClassArray ) PopFirst () (v ChannelParticipantClass , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero ChannelParticipantClass
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *ChannelParticipantClassArray ) Pop () (v ChannelParticipantClass , 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 ChannelParticipantClassArray ) AsChannelParticipant () (to ChannelParticipantArray ) {
for _ , elem := range s {
value , ok := elem .(*ChannelParticipant )
if !ok {
continue
}
to = append (to , *value )
}
return to
}
func (s ChannelParticipantClassArray ) AsChannelParticipantSelf () (to ChannelParticipantSelfArray ) {
for _ , elem := range s {
value , ok := elem .(*ChannelParticipantSelf )
if !ok {
continue
}
to = append (to , *value )
}
return to
}
func (s ChannelParticipantClassArray ) AsChannelParticipantCreator () (to ChannelParticipantCreatorArray ) {
for _ , elem := range s {
value , ok := elem .(*ChannelParticipantCreator )
if !ok {
continue
}
to = append (to , *value )
}
return to
}
func (s ChannelParticipantClassArray ) AsChannelParticipantAdmin () (to ChannelParticipantAdminArray ) {
for _ , elem := range s {
value , ok := elem .(*ChannelParticipantAdmin )
if !ok {
continue
}
to = append (to , *value )
}
return to
}
func (s ChannelParticipantClassArray ) AsChannelParticipantBanned () (to ChannelParticipantBannedArray ) {
for _ , elem := range s {
value , ok := elem .(*ChannelParticipantBanned )
if !ok {
continue
}
to = append (to , *value )
}
return to
}
func (s ChannelParticipantClassArray ) AsChannelParticipantLeft () (to ChannelParticipantLeftArray ) {
for _ , elem := range s {
value , ok := elem .(*ChannelParticipantLeft )
if !ok {
continue
}
to = append (to , *value )
}
return to
}
type ChannelParticipantArray []ChannelParticipant
func (s ChannelParticipantArray ) Sort (less func (a , b ChannelParticipant ) bool ) ChannelParticipantArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s ChannelParticipantArray ) SortStable (less func (a , b ChannelParticipant ) bool ) ChannelParticipantArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s ChannelParticipantArray ) Retain (keep func (x ChannelParticipant ) bool ) ChannelParticipantArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s ChannelParticipantArray ) First () (v ChannelParticipant , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s ChannelParticipantArray ) Last () (v ChannelParticipant , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *ChannelParticipantArray ) PopFirst () (v ChannelParticipant , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero ChannelParticipant
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *ChannelParticipantArray ) Pop () (v ChannelParticipant , 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 ChannelParticipantArray ) SortByDate () ChannelParticipantArray {
return s .Sort (func (a , b ChannelParticipant ) bool {
return a .GetDate () < b .GetDate ()
})
}
func (s ChannelParticipantArray ) SortStableByDate () ChannelParticipantArray {
return s .SortStable (func (a , b ChannelParticipant ) bool {
return a .GetDate () < b .GetDate ()
})
}
type ChannelParticipantSelfArray []ChannelParticipantSelf
func (s ChannelParticipantSelfArray ) Sort (less func (a , b ChannelParticipantSelf ) bool ) ChannelParticipantSelfArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s ChannelParticipantSelfArray ) SortStable (less func (a , b ChannelParticipantSelf ) bool ) ChannelParticipantSelfArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s ChannelParticipantSelfArray ) Retain (keep func (x ChannelParticipantSelf ) bool ) ChannelParticipantSelfArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s ChannelParticipantSelfArray ) First () (v ChannelParticipantSelf , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s ChannelParticipantSelfArray ) Last () (v ChannelParticipantSelf , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *ChannelParticipantSelfArray ) PopFirst () (v ChannelParticipantSelf , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero ChannelParticipantSelf
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *ChannelParticipantSelfArray ) Pop () (v ChannelParticipantSelf , 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 ChannelParticipantSelfArray ) SortByDate () ChannelParticipantSelfArray {
return s .Sort (func (a , b ChannelParticipantSelf ) bool {
return a .GetDate () < b .GetDate ()
})
}
func (s ChannelParticipantSelfArray ) SortStableByDate () ChannelParticipantSelfArray {
return s .SortStable (func (a , b ChannelParticipantSelf ) bool {
return a .GetDate () < b .GetDate ()
})
}
type ChannelParticipantCreatorArray []ChannelParticipantCreator
func (s ChannelParticipantCreatorArray ) Sort (less func (a , b ChannelParticipantCreator ) bool ) ChannelParticipantCreatorArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s ChannelParticipantCreatorArray ) SortStable (less func (a , b ChannelParticipantCreator ) bool ) ChannelParticipantCreatorArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s ChannelParticipantCreatorArray ) Retain (keep func (x ChannelParticipantCreator ) bool ) ChannelParticipantCreatorArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s ChannelParticipantCreatorArray ) First () (v ChannelParticipantCreator , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s ChannelParticipantCreatorArray ) Last () (v ChannelParticipantCreator , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *ChannelParticipantCreatorArray ) PopFirst () (v ChannelParticipantCreator , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero ChannelParticipantCreator
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *ChannelParticipantCreatorArray ) Pop () (v ChannelParticipantCreator , 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 ChannelParticipantAdminArray []ChannelParticipantAdmin
func (s ChannelParticipantAdminArray ) Sort (less func (a , b ChannelParticipantAdmin ) bool ) ChannelParticipantAdminArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s ChannelParticipantAdminArray ) SortStable (less func (a , b ChannelParticipantAdmin ) bool ) ChannelParticipantAdminArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s ChannelParticipantAdminArray ) Retain (keep func (x ChannelParticipantAdmin ) bool ) ChannelParticipantAdminArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s ChannelParticipantAdminArray ) First () (v ChannelParticipantAdmin , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s ChannelParticipantAdminArray ) Last () (v ChannelParticipantAdmin , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *ChannelParticipantAdminArray ) PopFirst () (v ChannelParticipantAdmin , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero ChannelParticipantAdmin
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *ChannelParticipantAdminArray ) Pop () (v ChannelParticipantAdmin , 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 ChannelParticipantAdminArray ) SortByDate () ChannelParticipantAdminArray {
return s .Sort (func (a , b ChannelParticipantAdmin ) bool {
return a .GetDate () < b .GetDate ()
})
}
func (s ChannelParticipantAdminArray ) SortStableByDate () ChannelParticipantAdminArray {
return s .SortStable (func (a , b ChannelParticipantAdmin ) bool {
return a .GetDate () < b .GetDate ()
})
}
type ChannelParticipantBannedArray []ChannelParticipantBanned
func (s ChannelParticipantBannedArray ) Sort (less func (a , b ChannelParticipantBanned ) bool ) ChannelParticipantBannedArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s ChannelParticipantBannedArray ) SortStable (less func (a , b ChannelParticipantBanned ) bool ) ChannelParticipantBannedArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s ChannelParticipantBannedArray ) Retain (keep func (x ChannelParticipantBanned ) bool ) ChannelParticipantBannedArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s ChannelParticipantBannedArray ) First () (v ChannelParticipantBanned , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s ChannelParticipantBannedArray ) Last () (v ChannelParticipantBanned , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *ChannelParticipantBannedArray ) PopFirst () (v ChannelParticipantBanned , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero ChannelParticipantBanned
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *ChannelParticipantBannedArray ) Pop () (v ChannelParticipantBanned , 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 ChannelParticipantBannedArray ) SortByDate () ChannelParticipantBannedArray {
return s .Sort (func (a , b ChannelParticipantBanned ) bool {
return a .GetDate () < b .GetDate ()
})
}
func (s ChannelParticipantBannedArray ) SortStableByDate () ChannelParticipantBannedArray {
return s .SortStable (func (a , b ChannelParticipantBanned ) bool {
return a .GetDate () < b .GetDate ()
})
}
type ChannelParticipantLeftArray []ChannelParticipantLeft
func (s ChannelParticipantLeftArray ) Sort (less func (a , b ChannelParticipantLeft ) bool ) ChannelParticipantLeftArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s ChannelParticipantLeftArray ) SortStable (less func (a , b ChannelParticipantLeft ) bool ) ChannelParticipantLeftArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s ChannelParticipantLeftArray ) Retain (keep func (x ChannelParticipantLeft ) bool ) ChannelParticipantLeftArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s ChannelParticipantLeftArray ) First () (v ChannelParticipantLeft , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s ChannelParticipantLeftArray ) Last () (v ChannelParticipantLeft , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *ChannelParticipantLeftArray ) PopFirst () (v ChannelParticipantLeft , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero ChannelParticipantLeft
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *ChannelParticipantLeftArray ) Pop () (v ChannelParticipantLeft , 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 .