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 UpdatesDifferenceClassArray []UpdatesDifferenceClass
func (s UpdatesDifferenceClassArray ) Sort (less func (a , b UpdatesDifferenceClass ) bool ) UpdatesDifferenceClassArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s UpdatesDifferenceClassArray ) SortStable (less func (a , b UpdatesDifferenceClass ) bool ) UpdatesDifferenceClassArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s UpdatesDifferenceClassArray ) Retain (keep func (x UpdatesDifferenceClass ) bool ) UpdatesDifferenceClassArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s UpdatesDifferenceClassArray ) First () (v UpdatesDifferenceClass , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s UpdatesDifferenceClassArray ) Last () (v UpdatesDifferenceClass , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *UpdatesDifferenceClassArray ) PopFirst () (v UpdatesDifferenceClass , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero UpdatesDifferenceClass
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *UpdatesDifferenceClassArray ) Pop () (v UpdatesDifferenceClass , 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 UpdatesDifferenceClassArray ) AsUpdatesDifferenceEmpty () (to UpdatesDifferenceEmptyArray ) {
for _ , elem := range s {
value , ok := elem .(*UpdatesDifferenceEmpty )
if !ok {
continue
}
to = append (to , *value )
}
return to
}
func (s UpdatesDifferenceClassArray ) AsUpdatesDifference () (to UpdatesDifferenceArray ) {
for _ , elem := range s {
value , ok := elem .(*UpdatesDifference )
if !ok {
continue
}
to = append (to , *value )
}
return to
}
func (s UpdatesDifferenceClassArray ) AsUpdatesDifferenceSlice () (to UpdatesDifferenceSliceArray ) {
for _ , elem := range s {
value , ok := elem .(*UpdatesDifferenceSlice )
if !ok {
continue
}
to = append (to , *value )
}
return to
}
func (s UpdatesDifferenceClassArray ) AsUpdatesDifferenceTooLong () (to UpdatesDifferenceTooLongArray ) {
for _ , elem := range s {
value , ok := elem .(*UpdatesDifferenceTooLong )
if !ok {
continue
}
to = append (to , *value )
}
return to
}
type UpdatesDifferenceEmptyArray []UpdatesDifferenceEmpty
func (s UpdatesDifferenceEmptyArray ) Sort (less func (a , b UpdatesDifferenceEmpty ) bool ) UpdatesDifferenceEmptyArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s UpdatesDifferenceEmptyArray ) SortStable (less func (a , b UpdatesDifferenceEmpty ) bool ) UpdatesDifferenceEmptyArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s UpdatesDifferenceEmptyArray ) Retain (keep func (x UpdatesDifferenceEmpty ) bool ) UpdatesDifferenceEmptyArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s UpdatesDifferenceEmptyArray ) First () (v UpdatesDifferenceEmpty , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s UpdatesDifferenceEmptyArray ) Last () (v UpdatesDifferenceEmpty , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *UpdatesDifferenceEmptyArray ) PopFirst () (v UpdatesDifferenceEmpty , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero UpdatesDifferenceEmpty
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *UpdatesDifferenceEmptyArray ) Pop () (v UpdatesDifferenceEmpty , 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 UpdatesDifferenceEmptyArray ) SortByDate () UpdatesDifferenceEmptyArray {
return s .Sort (func (a , b UpdatesDifferenceEmpty ) bool {
return a .GetDate () < b .GetDate ()
})
}
func (s UpdatesDifferenceEmptyArray ) SortStableByDate () UpdatesDifferenceEmptyArray {
return s .SortStable (func (a , b UpdatesDifferenceEmpty ) bool {
return a .GetDate () < b .GetDate ()
})
}
type UpdatesDifferenceArray []UpdatesDifference
func (s UpdatesDifferenceArray ) Sort (less func (a , b UpdatesDifference ) bool ) UpdatesDifferenceArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s UpdatesDifferenceArray ) SortStable (less func (a , b UpdatesDifference ) bool ) UpdatesDifferenceArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s UpdatesDifferenceArray ) Retain (keep func (x UpdatesDifference ) bool ) UpdatesDifferenceArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s UpdatesDifferenceArray ) First () (v UpdatesDifference , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s UpdatesDifferenceArray ) Last () (v UpdatesDifference , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *UpdatesDifferenceArray ) PopFirst () (v UpdatesDifference , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero UpdatesDifference
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *UpdatesDifferenceArray ) Pop () (v UpdatesDifference , 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 UpdatesDifferenceSliceArray []UpdatesDifferenceSlice
func (s UpdatesDifferenceSliceArray ) Sort (less func (a , b UpdatesDifferenceSlice ) bool ) UpdatesDifferenceSliceArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s UpdatesDifferenceSliceArray ) SortStable (less func (a , b UpdatesDifferenceSlice ) bool ) UpdatesDifferenceSliceArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s UpdatesDifferenceSliceArray ) Retain (keep func (x UpdatesDifferenceSlice ) bool ) UpdatesDifferenceSliceArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s UpdatesDifferenceSliceArray ) First () (v UpdatesDifferenceSlice , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s UpdatesDifferenceSliceArray ) Last () (v UpdatesDifferenceSlice , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *UpdatesDifferenceSliceArray ) PopFirst () (v UpdatesDifferenceSlice , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero UpdatesDifferenceSlice
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *UpdatesDifferenceSliceArray ) Pop () (v UpdatesDifferenceSlice , 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 UpdatesDifferenceTooLongArray []UpdatesDifferenceTooLong
func (s UpdatesDifferenceTooLongArray ) Sort (less func (a , b UpdatesDifferenceTooLong ) bool ) UpdatesDifferenceTooLongArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s UpdatesDifferenceTooLongArray ) SortStable (less func (a , b UpdatesDifferenceTooLong ) bool ) UpdatesDifferenceTooLongArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s UpdatesDifferenceTooLongArray ) Retain (keep func (x UpdatesDifferenceTooLong ) bool ) UpdatesDifferenceTooLongArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s UpdatesDifferenceTooLongArray ) First () (v UpdatesDifferenceTooLong , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s UpdatesDifferenceTooLongArray ) Last () (v UpdatesDifferenceTooLong , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *UpdatesDifferenceTooLongArray ) PopFirst () (v UpdatesDifferenceTooLong , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero UpdatesDifferenceTooLong
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *UpdatesDifferenceTooLongArray ) Pop () (v UpdatesDifferenceTooLong , 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 .