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 ChatParticipantClassArray []ChatParticipantClass
func (s ChatParticipantClassArray ) Sort (less func (a , b ChatParticipantClass ) bool ) ChatParticipantClassArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s ChatParticipantClassArray ) SortStable (less func (a , b ChatParticipantClass ) bool ) ChatParticipantClassArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s ChatParticipantClassArray ) Retain (keep func (x ChatParticipantClass ) bool ) ChatParticipantClassArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s ChatParticipantClassArray ) First () (v ChatParticipantClass , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s ChatParticipantClassArray ) Last () (v ChatParticipantClass , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *ChatParticipantClassArray ) PopFirst () (v ChatParticipantClass , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero ChatParticipantClass
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *ChatParticipantClassArray ) Pop () (v ChatParticipantClass , 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 ChatParticipantClassArray ) AsChatParticipant () (to ChatParticipantArray ) {
for _ , elem := range s {
value , ok := elem .(*ChatParticipant )
if !ok {
continue
}
to = append (to , *value )
}
return to
}
func (s ChatParticipantClassArray ) AsChatParticipantCreator () (to ChatParticipantCreatorArray ) {
for _ , elem := range s {
value , ok := elem .(*ChatParticipantCreator )
if !ok {
continue
}
to = append (to , *value )
}
return to
}
func (s ChatParticipantClassArray ) AsChatParticipantAdmin () (to ChatParticipantAdminArray ) {
for _ , elem := range s {
value , ok := elem .(*ChatParticipantAdmin )
if !ok {
continue
}
to = append (to , *value )
}
return to
}
type ChatParticipantArray []ChatParticipant
func (s ChatParticipantArray ) Sort (less func (a , b ChatParticipant ) bool ) ChatParticipantArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s ChatParticipantArray ) SortStable (less func (a , b ChatParticipant ) bool ) ChatParticipantArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s ChatParticipantArray ) Retain (keep func (x ChatParticipant ) bool ) ChatParticipantArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s ChatParticipantArray ) First () (v ChatParticipant , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s ChatParticipantArray ) Last () (v ChatParticipant , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *ChatParticipantArray ) PopFirst () (v ChatParticipant , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero ChatParticipant
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *ChatParticipantArray ) Pop () (v ChatParticipant , 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 ChatParticipantArray ) SortByDate () ChatParticipantArray {
return s .Sort (func (a , b ChatParticipant ) bool {
return a .GetDate () < b .GetDate ()
})
}
func (s ChatParticipantArray ) SortStableByDate () ChatParticipantArray {
return s .SortStable (func (a , b ChatParticipant ) bool {
return a .GetDate () < b .GetDate ()
})
}
type ChatParticipantCreatorArray []ChatParticipantCreator
func (s ChatParticipantCreatorArray ) Sort (less func (a , b ChatParticipantCreator ) bool ) ChatParticipantCreatorArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s ChatParticipantCreatorArray ) SortStable (less func (a , b ChatParticipantCreator ) bool ) ChatParticipantCreatorArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s ChatParticipantCreatorArray ) Retain (keep func (x ChatParticipantCreator ) bool ) ChatParticipantCreatorArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s ChatParticipantCreatorArray ) First () (v ChatParticipantCreator , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s ChatParticipantCreatorArray ) Last () (v ChatParticipantCreator , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *ChatParticipantCreatorArray ) PopFirst () (v ChatParticipantCreator , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero ChatParticipantCreator
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *ChatParticipantCreatorArray ) Pop () (v ChatParticipantCreator , 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 ChatParticipantAdminArray []ChatParticipantAdmin
func (s ChatParticipantAdminArray ) Sort (less func (a , b ChatParticipantAdmin ) bool ) ChatParticipantAdminArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s ChatParticipantAdminArray ) SortStable (less func (a , b ChatParticipantAdmin ) bool ) ChatParticipantAdminArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s ChatParticipantAdminArray ) Retain (keep func (x ChatParticipantAdmin ) bool ) ChatParticipantAdminArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s ChatParticipantAdminArray ) First () (v ChatParticipantAdmin , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s ChatParticipantAdminArray ) Last () (v ChatParticipantAdmin , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *ChatParticipantAdminArray ) PopFirst () (v ChatParticipantAdmin , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero ChatParticipantAdmin
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *ChatParticipantAdminArray ) Pop () (v ChatParticipantAdmin , 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 ChatParticipantAdminArray ) SortByDate () ChatParticipantAdminArray {
return s .Sort (func (a , b ChatParticipantAdmin ) bool {
return a .GetDate () < b .GetDate ()
})
}
func (s ChatParticipantAdminArray ) SortStableByDate () ChatParticipantAdminArray {
return s .SortStable (func (a , b ChatParticipantAdmin ) bool {
return a .GetDate () < b .GetDate ()
})
}
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 .