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 UpdatesChannelDifferenceClassArray []UpdatesChannelDifferenceClass
func (s UpdatesChannelDifferenceClassArray ) Sort (less func (a , b UpdatesChannelDifferenceClass ) bool ) UpdatesChannelDifferenceClassArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s UpdatesChannelDifferenceClassArray ) SortStable (less func (a , b UpdatesChannelDifferenceClass ) bool ) UpdatesChannelDifferenceClassArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s UpdatesChannelDifferenceClassArray ) Retain (keep func (x UpdatesChannelDifferenceClass ) bool ) UpdatesChannelDifferenceClassArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s UpdatesChannelDifferenceClassArray ) First () (v UpdatesChannelDifferenceClass , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s UpdatesChannelDifferenceClassArray ) Last () (v UpdatesChannelDifferenceClass , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *UpdatesChannelDifferenceClassArray ) PopFirst () (v UpdatesChannelDifferenceClass , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero UpdatesChannelDifferenceClass
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *UpdatesChannelDifferenceClassArray ) Pop () (v UpdatesChannelDifferenceClass , 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 UpdatesChannelDifferenceClassArray ) AsUpdatesChannelDifferenceEmpty () (to UpdatesChannelDifferenceEmptyArray ) {
for _ , elem := range s {
value , ok := elem .(*UpdatesChannelDifferenceEmpty )
if !ok {
continue
}
to = append (to , *value )
}
return to
}
func (s UpdatesChannelDifferenceClassArray ) AsUpdatesChannelDifferenceTooLong () (to UpdatesChannelDifferenceTooLongArray ) {
for _ , elem := range s {
value , ok := elem .(*UpdatesChannelDifferenceTooLong )
if !ok {
continue
}
to = append (to , *value )
}
return to
}
func (s UpdatesChannelDifferenceClassArray ) AsUpdatesChannelDifference () (to UpdatesChannelDifferenceArray ) {
for _ , elem := range s {
value , ok := elem .(*UpdatesChannelDifference )
if !ok {
continue
}
to = append (to , *value )
}
return to
}
func (s UpdatesChannelDifferenceClassArray ) AppendOnlyNotEmpty (to []NotEmptyUpdatesChannelDifference ) []NotEmptyUpdatesChannelDifference {
for _ , elem := range s {
value , ok := elem .AsNotEmpty ()
if !ok {
continue
}
to = append (to , value )
}
return to
}
func (s UpdatesChannelDifferenceClassArray ) AsNotEmpty () (to []NotEmptyUpdatesChannelDifference ) {
return s .AppendOnlyNotEmpty (to )
}
func (s UpdatesChannelDifferenceClassArray ) FirstAsNotEmpty () (v NotEmptyUpdatesChannelDifference , ok bool ) {
value , ok := s .First ()
if !ok {
return
}
return value .AsNotEmpty ()
}
func (s UpdatesChannelDifferenceClassArray ) LastAsNotEmpty () (v NotEmptyUpdatesChannelDifference , ok bool ) {
value , ok := s .Last ()
if !ok {
return
}
return value .AsNotEmpty ()
}
func (s *UpdatesChannelDifferenceClassArray ) PopFirstAsNotEmpty () (v NotEmptyUpdatesChannelDifference , ok bool ) {
value , ok := s .PopFirst ()
if !ok {
return
}
return value .AsNotEmpty ()
}
func (s *UpdatesChannelDifferenceClassArray ) PopAsNotEmpty () (v NotEmptyUpdatesChannelDifference , ok bool ) {
value , ok := s .Pop ()
if !ok {
return
}
return value .AsNotEmpty ()
}
type UpdatesChannelDifferenceEmptyArray []UpdatesChannelDifferenceEmpty
func (s UpdatesChannelDifferenceEmptyArray ) Sort (less func (a , b UpdatesChannelDifferenceEmpty ) bool ) UpdatesChannelDifferenceEmptyArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s UpdatesChannelDifferenceEmptyArray ) SortStable (less func (a , b UpdatesChannelDifferenceEmpty ) bool ) UpdatesChannelDifferenceEmptyArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s UpdatesChannelDifferenceEmptyArray ) Retain (keep func (x UpdatesChannelDifferenceEmpty ) bool ) UpdatesChannelDifferenceEmptyArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s UpdatesChannelDifferenceEmptyArray ) First () (v UpdatesChannelDifferenceEmpty , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s UpdatesChannelDifferenceEmptyArray ) Last () (v UpdatesChannelDifferenceEmpty , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *UpdatesChannelDifferenceEmptyArray ) PopFirst () (v UpdatesChannelDifferenceEmpty , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero UpdatesChannelDifferenceEmpty
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *UpdatesChannelDifferenceEmptyArray ) Pop () (v UpdatesChannelDifferenceEmpty , 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 UpdatesChannelDifferenceTooLongArray []UpdatesChannelDifferenceTooLong
func (s UpdatesChannelDifferenceTooLongArray ) Sort (less func (a , b UpdatesChannelDifferenceTooLong ) bool ) UpdatesChannelDifferenceTooLongArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s UpdatesChannelDifferenceTooLongArray ) SortStable (less func (a , b UpdatesChannelDifferenceTooLong ) bool ) UpdatesChannelDifferenceTooLongArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s UpdatesChannelDifferenceTooLongArray ) Retain (keep func (x UpdatesChannelDifferenceTooLong ) bool ) UpdatesChannelDifferenceTooLongArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s UpdatesChannelDifferenceTooLongArray ) First () (v UpdatesChannelDifferenceTooLong , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s UpdatesChannelDifferenceTooLongArray ) Last () (v UpdatesChannelDifferenceTooLong , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *UpdatesChannelDifferenceTooLongArray ) PopFirst () (v UpdatesChannelDifferenceTooLong , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero UpdatesChannelDifferenceTooLong
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *UpdatesChannelDifferenceTooLongArray ) Pop () (v UpdatesChannelDifferenceTooLong , 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 UpdatesChannelDifferenceArray []UpdatesChannelDifference
func (s UpdatesChannelDifferenceArray ) Sort (less func (a , b UpdatesChannelDifference ) bool ) UpdatesChannelDifferenceArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s UpdatesChannelDifferenceArray ) SortStable (less func (a , b UpdatesChannelDifference ) bool ) UpdatesChannelDifferenceArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s UpdatesChannelDifferenceArray ) Retain (keep func (x UpdatesChannelDifference ) bool ) UpdatesChannelDifferenceArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s UpdatesChannelDifferenceArray ) First () (v UpdatesChannelDifference , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s UpdatesChannelDifferenceArray ) Last () (v UpdatesChannelDifference , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *UpdatesChannelDifferenceArray ) PopFirst () (v UpdatesChannelDifference , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero UpdatesChannelDifference
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *UpdatesChannelDifferenceArray ) Pop () (v UpdatesChannelDifference , 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 .