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 MessagesMessagesClassArray []MessagesMessagesClass
func (s MessagesMessagesClassArray ) Sort (less func (a , b MessagesMessagesClass ) bool ) MessagesMessagesClassArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s MessagesMessagesClassArray ) SortStable (less func (a , b MessagesMessagesClass ) bool ) MessagesMessagesClassArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s MessagesMessagesClassArray ) Retain (keep func (x MessagesMessagesClass ) bool ) MessagesMessagesClassArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s MessagesMessagesClassArray ) First () (v MessagesMessagesClass , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s MessagesMessagesClassArray ) Last () (v MessagesMessagesClass , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *MessagesMessagesClassArray ) PopFirst () (v MessagesMessagesClass , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero MessagesMessagesClass
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *MessagesMessagesClassArray ) Pop () (v MessagesMessagesClass , 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 MessagesMessagesClassArray ) AsMessagesMessages () (to MessagesMessagesArray ) {
for _ , elem := range s {
value , ok := elem .(*MessagesMessages )
if !ok {
continue
}
to = append (to , *value )
}
return to
}
func (s MessagesMessagesClassArray ) AsMessagesMessagesSlice () (to MessagesMessagesSliceArray ) {
for _ , elem := range s {
value , ok := elem .(*MessagesMessagesSlice )
if !ok {
continue
}
to = append (to , *value )
}
return to
}
func (s MessagesMessagesClassArray ) AsMessagesChannelMessages () (to MessagesChannelMessagesArray ) {
for _ , elem := range s {
value , ok := elem .(*MessagesChannelMessages )
if !ok {
continue
}
to = append (to , *value )
}
return to
}
func (s MessagesMessagesClassArray ) AsMessagesMessagesNotModified () (to MessagesMessagesNotModifiedArray ) {
for _ , elem := range s {
value , ok := elem .(*MessagesMessagesNotModified )
if !ok {
continue
}
to = append (to , *value )
}
return to
}
func (s MessagesMessagesClassArray ) AppendOnlyModified (to []ModifiedMessagesMessages ) []ModifiedMessagesMessages {
for _ , elem := range s {
value , ok := elem .AsModified ()
if !ok {
continue
}
to = append (to , value )
}
return to
}
func (s MessagesMessagesClassArray ) AsModified () (to []ModifiedMessagesMessages ) {
return s .AppendOnlyModified (to )
}
func (s MessagesMessagesClassArray ) FirstAsModified () (v ModifiedMessagesMessages , ok bool ) {
value , ok := s .First ()
if !ok {
return
}
return value .AsModified ()
}
func (s MessagesMessagesClassArray ) LastAsModified () (v ModifiedMessagesMessages , ok bool ) {
value , ok := s .Last ()
if !ok {
return
}
return value .AsModified ()
}
func (s *MessagesMessagesClassArray ) PopFirstAsModified () (v ModifiedMessagesMessages , ok bool ) {
value , ok := s .PopFirst ()
if !ok {
return
}
return value .AsModified ()
}
func (s *MessagesMessagesClassArray ) PopAsModified () (v ModifiedMessagesMessages , ok bool ) {
value , ok := s .Pop ()
if !ok {
return
}
return value .AsModified ()
}
type MessagesMessagesArray []MessagesMessages
func (s MessagesMessagesArray ) Sort (less func (a , b MessagesMessages ) bool ) MessagesMessagesArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s MessagesMessagesArray ) SortStable (less func (a , b MessagesMessages ) bool ) MessagesMessagesArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s MessagesMessagesArray ) Retain (keep func (x MessagesMessages ) bool ) MessagesMessagesArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s MessagesMessagesArray ) First () (v MessagesMessages , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s MessagesMessagesArray ) Last () (v MessagesMessages , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *MessagesMessagesArray ) PopFirst () (v MessagesMessages , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero MessagesMessages
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *MessagesMessagesArray ) Pop () (v MessagesMessages , 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 MessagesMessagesSliceArray []MessagesMessagesSlice
func (s MessagesMessagesSliceArray ) Sort (less func (a , b MessagesMessagesSlice ) bool ) MessagesMessagesSliceArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s MessagesMessagesSliceArray ) SortStable (less func (a , b MessagesMessagesSlice ) bool ) MessagesMessagesSliceArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s MessagesMessagesSliceArray ) Retain (keep func (x MessagesMessagesSlice ) bool ) MessagesMessagesSliceArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s MessagesMessagesSliceArray ) First () (v MessagesMessagesSlice , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s MessagesMessagesSliceArray ) Last () (v MessagesMessagesSlice , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *MessagesMessagesSliceArray ) PopFirst () (v MessagesMessagesSlice , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero MessagesMessagesSlice
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *MessagesMessagesSliceArray ) Pop () (v MessagesMessagesSlice , 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 MessagesChannelMessagesArray []MessagesChannelMessages
func (s MessagesChannelMessagesArray ) Sort (less func (a , b MessagesChannelMessages ) bool ) MessagesChannelMessagesArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s MessagesChannelMessagesArray ) SortStable (less func (a , b MessagesChannelMessages ) bool ) MessagesChannelMessagesArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s MessagesChannelMessagesArray ) Retain (keep func (x MessagesChannelMessages ) bool ) MessagesChannelMessagesArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s MessagesChannelMessagesArray ) First () (v MessagesChannelMessages , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s MessagesChannelMessagesArray ) Last () (v MessagesChannelMessages , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *MessagesChannelMessagesArray ) PopFirst () (v MessagesChannelMessages , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero MessagesChannelMessages
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *MessagesChannelMessagesArray ) Pop () (v MessagesChannelMessages , 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 MessagesMessagesNotModifiedArray []MessagesMessagesNotModified
func (s MessagesMessagesNotModifiedArray ) Sort (less func (a , b MessagesMessagesNotModified ) bool ) MessagesMessagesNotModifiedArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s MessagesMessagesNotModifiedArray ) SortStable (less func (a , b MessagesMessagesNotModified ) bool ) MessagesMessagesNotModifiedArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s MessagesMessagesNotModifiedArray ) Retain (keep func (x MessagesMessagesNotModified ) bool ) MessagesMessagesNotModifiedArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s MessagesMessagesNotModifiedArray ) First () (v MessagesMessagesNotModified , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s MessagesMessagesNotModifiedArray ) Last () (v MessagesMessagesNotModified , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *MessagesMessagesNotModifiedArray ) PopFirst () (v MessagesMessagesNotModified , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero MessagesMessagesNotModified
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *MessagesMessagesNotModifiedArray ) Pop () (v MessagesMessagesNotModified , 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 .