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 InputFileLocationClassArray []InputFileLocationClass
func (s InputFileLocationClassArray ) Sort (less func (a , b InputFileLocationClass ) bool ) InputFileLocationClassArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s InputFileLocationClassArray ) SortStable (less func (a , b InputFileLocationClass ) bool ) InputFileLocationClassArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s InputFileLocationClassArray ) Retain (keep func (x InputFileLocationClass ) bool ) InputFileLocationClassArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s InputFileLocationClassArray ) First () (v InputFileLocationClass , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s InputFileLocationClassArray ) Last () (v InputFileLocationClass , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *InputFileLocationClassArray ) PopFirst () (v InputFileLocationClass , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero InputFileLocationClass
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *InputFileLocationClassArray ) Pop () (v InputFileLocationClass , 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 InputFileLocationClassArray ) AsInputFileLocation () (to InputFileLocationArray ) {
for _ , elem := range s {
value , ok := elem .(*InputFileLocation )
if !ok {
continue
}
to = append (to , *value )
}
return to
}
func (s InputFileLocationClassArray ) AsInputEncryptedFileLocation () (to InputEncryptedFileLocationArray ) {
for _ , elem := range s {
value , ok := elem .(*InputEncryptedFileLocation )
if !ok {
continue
}
to = append (to , *value )
}
return to
}
func (s InputFileLocationClassArray ) AsInputDocumentFileLocation () (to InputDocumentFileLocationArray ) {
for _ , elem := range s {
value , ok := elem .(*InputDocumentFileLocation )
if !ok {
continue
}
to = append (to , *value )
}
return to
}
func (s InputFileLocationClassArray ) AsInputSecureFileLocation () (to InputSecureFileLocationArray ) {
for _ , elem := range s {
value , ok := elem .(*InputSecureFileLocation )
if !ok {
continue
}
to = append (to , *value )
}
return to
}
func (s InputFileLocationClassArray ) AsInputPhotoFileLocation () (to InputPhotoFileLocationArray ) {
for _ , elem := range s {
value , ok := elem .(*InputPhotoFileLocation )
if !ok {
continue
}
to = append (to , *value )
}
return to
}
func (s InputFileLocationClassArray ) AsInputPhotoLegacyFileLocation () (to InputPhotoLegacyFileLocationArray ) {
for _ , elem := range s {
value , ok := elem .(*InputPhotoLegacyFileLocation )
if !ok {
continue
}
to = append (to , *value )
}
return to
}
func (s InputFileLocationClassArray ) AsInputPeerPhotoFileLocation () (to InputPeerPhotoFileLocationArray ) {
for _ , elem := range s {
value , ok := elem .(*InputPeerPhotoFileLocation )
if !ok {
continue
}
to = append (to , *value )
}
return to
}
func (s InputFileLocationClassArray ) AsInputStickerSetThumb () (to InputStickerSetThumbArray ) {
for _ , elem := range s {
value , ok := elem .(*InputStickerSetThumb )
if !ok {
continue
}
to = append (to , *value )
}
return to
}
func (s InputFileLocationClassArray ) AsInputGroupCallStream () (to InputGroupCallStreamArray ) {
for _ , elem := range s {
value , ok := elem .(*InputGroupCallStream )
if !ok {
continue
}
to = append (to , *value )
}
return to
}
func (s InputFileLocationClassArray ) AsInputPeerPhotoFileLocationLegacy () (to InputPeerPhotoFileLocationLegacyArray ) {
for _ , elem := range s {
value , ok := elem .(*InputPeerPhotoFileLocationLegacy )
if !ok {
continue
}
to = append (to , *value )
}
return to
}
func (s InputFileLocationClassArray ) AsInputStickerSetThumbLegacy () (to InputStickerSetThumbLegacyArray ) {
for _ , elem := range s {
value , ok := elem .(*InputStickerSetThumbLegacy )
if !ok {
continue
}
to = append (to , *value )
}
return to
}
type InputFileLocationArray []InputFileLocation
func (s InputFileLocationArray ) Sort (less func (a , b InputFileLocation ) bool ) InputFileLocationArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s InputFileLocationArray ) SortStable (less func (a , b InputFileLocation ) bool ) InputFileLocationArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s InputFileLocationArray ) Retain (keep func (x InputFileLocation ) bool ) InputFileLocationArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s InputFileLocationArray ) First () (v InputFileLocation , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s InputFileLocationArray ) Last () (v InputFileLocation , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *InputFileLocationArray ) PopFirst () (v InputFileLocation , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero InputFileLocation
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *InputFileLocationArray ) Pop () (v InputFileLocation , 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 InputEncryptedFileLocationArray []InputEncryptedFileLocation
func (s InputEncryptedFileLocationArray ) Sort (less func (a , b InputEncryptedFileLocation ) bool ) InputEncryptedFileLocationArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s InputEncryptedFileLocationArray ) SortStable (less func (a , b InputEncryptedFileLocation ) bool ) InputEncryptedFileLocationArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s InputEncryptedFileLocationArray ) Retain (keep func (x InputEncryptedFileLocation ) bool ) InputEncryptedFileLocationArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s InputEncryptedFileLocationArray ) First () (v InputEncryptedFileLocation , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s InputEncryptedFileLocationArray ) Last () (v InputEncryptedFileLocation , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *InputEncryptedFileLocationArray ) PopFirst () (v InputEncryptedFileLocation , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero InputEncryptedFileLocation
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *InputEncryptedFileLocationArray ) Pop () (v InputEncryptedFileLocation , 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 InputEncryptedFileLocationArray ) SortByID () InputEncryptedFileLocationArray {
return s .Sort (func (a , b InputEncryptedFileLocation ) bool {
return a .GetID () < b .GetID ()
})
}
func (s InputEncryptedFileLocationArray ) SortStableByID () InputEncryptedFileLocationArray {
return s .SortStable (func (a , b InputEncryptedFileLocation ) bool {
return a .GetID () < b .GetID ()
})
}
func (s InputEncryptedFileLocationArray ) FillMap (to map [int64 ]InputEncryptedFileLocation ) {
for _ , value := range s {
to [value .GetID ()] = value
}
}
func (s InputEncryptedFileLocationArray ) ToMap () map [int64 ]InputEncryptedFileLocation {
r := make (map [int64 ]InputEncryptedFileLocation , len (s ))
s .FillMap (r )
return r
}
type InputDocumentFileLocationArray []InputDocumentFileLocation
func (s InputDocumentFileLocationArray ) Sort (less func (a , b InputDocumentFileLocation ) bool ) InputDocumentFileLocationArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s InputDocumentFileLocationArray ) SortStable (less func (a , b InputDocumentFileLocation ) bool ) InputDocumentFileLocationArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s InputDocumentFileLocationArray ) Retain (keep func (x InputDocumentFileLocation ) bool ) InputDocumentFileLocationArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s InputDocumentFileLocationArray ) First () (v InputDocumentFileLocation , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s InputDocumentFileLocationArray ) Last () (v InputDocumentFileLocation , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *InputDocumentFileLocationArray ) PopFirst () (v InputDocumentFileLocation , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero InputDocumentFileLocation
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *InputDocumentFileLocationArray ) Pop () (v InputDocumentFileLocation , 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 InputDocumentFileLocationArray ) SortByID () InputDocumentFileLocationArray {
return s .Sort (func (a , b InputDocumentFileLocation ) bool {
return a .GetID () < b .GetID ()
})
}
func (s InputDocumentFileLocationArray ) SortStableByID () InputDocumentFileLocationArray {
return s .SortStable (func (a , b InputDocumentFileLocation ) bool {
return a .GetID () < b .GetID ()
})
}
func (s InputDocumentFileLocationArray ) FillMap (to map [int64 ]InputDocumentFileLocation ) {
for _ , value := range s {
to [value .GetID ()] = value
}
}
func (s InputDocumentFileLocationArray ) ToMap () map [int64 ]InputDocumentFileLocation {
r := make (map [int64 ]InputDocumentFileLocation , len (s ))
s .FillMap (r )
return r
}
type InputSecureFileLocationArray []InputSecureFileLocation
func (s InputSecureFileLocationArray ) Sort (less func (a , b InputSecureFileLocation ) bool ) InputSecureFileLocationArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s InputSecureFileLocationArray ) SortStable (less func (a , b InputSecureFileLocation ) bool ) InputSecureFileLocationArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s InputSecureFileLocationArray ) Retain (keep func (x InputSecureFileLocation ) bool ) InputSecureFileLocationArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s InputSecureFileLocationArray ) First () (v InputSecureFileLocation , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s InputSecureFileLocationArray ) Last () (v InputSecureFileLocation , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *InputSecureFileLocationArray ) PopFirst () (v InputSecureFileLocation , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero InputSecureFileLocation
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *InputSecureFileLocationArray ) Pop () (v InputSecureFileLocation , 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 InputSecureFileLocationArray ) SortByID () InputSecureFileLocationArray {
return s .Sort (func (a , b InputSecureFileLocation ) bool {
return a .GetID () < b .GetID ()
})
}
func (s InputSecureFileLocationArray ) SortStableByID () InputSecureFileLocationArray {
return s .SortStable (func (a , b InputSecureFileLocation ) bool {
return a .GetID () < b .GetID ()
})
}
func (s InputSecureFileLocationArray ) FillMap (to map [int64 ]InputSecureFileLocation ) {
for _ , value := range s {
to [value .GetID ()] = value
}
}
func (s InputSecureFileLocationArray ) ToMap () map [int64 ]InputSecureFileLocation {
r := make (map [int64 ]InputSecureFileLocation , len (s ))
s .FillMap (r )
return r
}
type InputPhotoFileLocationArray []InputPhotoFileLocation
func (s InputPhotoFileLocationArray ) Sort (less func (a , b InputPhotoFileLocation ) bool ) InputPhotoFileLocationArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s InputPhotoFileLocationArray ) SortStable (less func (a , b InputPhotoFileLocation ) bool ) InputPhotoFileLocationArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s InputPhotoFileLocationArray ) Retain (keep func (x InputPhotoFileLocation ) bool ) InputPhotoFileLocationArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s InputPhotoFileLocationArray ) First () (v InputPhotoFileLocation , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s InputPhotoFileLocationArray ) Last () (v InputPhotoFileLocation , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *InputPhotoFileLocationArray ) PopFirst () (v InputPhotoFileLocation , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero InputPhotoFileLocation
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *InputPhotoFileLocationArray ) Pop () (v InputPhotoFileLocation , 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 InputPhotoFileLocationArray ) SortByID () InputPhotoFileLocationArray {
return s .Sort (func (a , b InputPhotoFileLocation ) bool {
return a .GetID () < b .GetID ()
})
}
func (s InputPhotoFileLocationArray ) SortStableByID () InputPhotoFileLocationArray {
return s .SortStable (func (a , b InputPhotoFileLocation ) bool {
return a .GetID () < b .GetID ()
})
}
func (s InputPhotoFileLocationArray ) FillMap (to map [int64 ]InputPhotoFileLocation ) {
for _ , value := range s {
to [value .GetID ()] = value
}
}
func (s InputPhotoFileLocationArray ) ToMap () map [int64 ]InputPhotoFileLocation {
r := make (map [int64 ]InputPhotoFileLocation , len (s ))
s .FillMap (r )
return r
}
type InputPhotoLegacyFileLocationArray []InputPhotoLegacyFileLocation
func (s InputPhotoLegacyFileLocationArray ) Sort (less func (a , b InputPhotoLegacyFileLocation ) bool ) InputPhotoLegacyFileLocationArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s InputPhotoLegacyFileLocationArray ) SortStable (less func (a , b InputPhotoLegacyFileLocation ) bool ) InputPhotoLegacyFileLocationArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s InputPhotoLegacyFileLocationArray ) Retain (keep func (x InputPhotoLegacyFileLocation ) bool ) InputPhotoLegacyFileLocationArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s InputPhotoLegacyFileLocationArray ) First () (v InputPhotoLegacyFileLocation , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s InputPhotoLegacyFileLocationArray ) Last () (v InputPhotoLegacyFileLocation , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *InputPhotoLegacyFileLocationArray ) PopFirst () (v InputPhotoLegacyFileLocation , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero InputPhotoLegacyFileLocation
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *InputPhotoLegacyFileLocationArray ) Pop () (v InputPhotoLegacyFileLocation , 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 InputPhotoLegacyFileLocationArray ) SortByID () InputPhotoLegacyFileLocationArray {
return s .Sort (func (a , b InputPhotoLegacyFileLocation ) bool {
return a .GetID () < b .GetID ()
})
}
func (s InputPhotoLegacyFileLocationArray ) SortStableByID () InputPhotoLegacyFileLocationArray {
return s .SortStable (func (a , b InputPhotoLegacyFileLocation ) bool {
return a .GetID () < b .GetID ()
})
}
func (s InputPhotoLegacyFileLocationArray ) FillMap (to map [int64 ]InputPhotoLegacyFileLocation ) {
for _ , value := range s {
to [value .GetID ()] = value
}
}
func (s InputPhotoLegacyFileLocationArray ) ToMap () map [int64 ]InputPhotoLegacyFileLocation {
r := make (map [int64 ]InputPhotoLegacyFileLocation , len (s ))
s .FillMap (r )
return r
}
type InputPeerPhotoFileLocationArray []InputPeerPhotoFileLocation
func (s InputPeerPhotoFileLocationArray ) Sort (less func (a , b InputPeerPhotoFileLocation ) bool ) InputPeerPhotoFileLocationArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s InputPeerPhotoFileLocationArray ) SortStable (less func (a , b InputPeerPhotoFileLocation ) bool ) InputPeerPhotoFileLocationArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s InputPeerPhotoFileLocationArray ) Retain (keep func (x InputPeerPhotoFileLocation ) bool ) InputPeerPhotoFileLocationArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s InputPeerPhotoFileLocationArray ) First () (v InputPeerPhotoFileLocation , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s InputPeerPhotoFileLocationArray ) Last () (v InputPeerPhotoFileLocation , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *InputPeerPhotoFileLocationArray ) PopFirst () (v InputPeerPhotoFileLocation , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero InputPeerPhotoFileLocation
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *InputPeerPhotoFileLocationArray ) Pop () (v InputPeerPhotoFileLocation , 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 InputStickerSetThumbArray []InputStickerSetThumb
func (s InputStickerSetThumbArray ) Sort (less func (a , b InputStickerSetThumb ) bool ) InputStickerSetThumbArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s InputStickerSetThumbArray ) SortStable (less func (a , b InputStickerSetThumb ) bool ) InputStickerSetThumbArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s InputStickerSetThumbArray ) Retain (keep func (x InputStickerSetThumb ) bool ) InputStickerSetThumbArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s InputStickerSetThumbArray ) First () (v InputStickerSetThumb , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s InputStickerSetThumbArray ) Last () (v InputStickerSetThumb , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *InputStickerSetThumbArray ) PopFirst () (v InputStickerSetThumb , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero InputStickerSetThumb
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *InputStickerSetThumbArray ) Pop () (v InputStickerSetThumb , 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 InputGroupCallStreamArray []InputGroupCallStream
func (s InputGroupCallStreamArray ) Sort (less func (a , b InputGroupCallStream ) bool ) InputGroupCallStreamArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s InputGroupCallStreamArray ) SortStable (less func (a , b InputGroupCallStream ) bool ) InputGroupCallStreamArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s InputGroupCallStreamArray ) Retain (keep func (x InputGroupCallStream ) bool ) InputGroupCallStreamArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s InputGroupCallStreamArray ) First () (v InputGroupCallStream , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s InputGroupCallStreamArray ) Last () (v InputGroupCallStream , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *InputGroupCallStreamArray ) PopFirst () (v InputGroupCallStream , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero InputGroupCallStream
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *InputGroupCallStreamArray ) Pop () (v InputGroupCallStream , 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 InputPeerPhotoFileLocationLegacyArray []InputPeerPhotoFileLocationLegacy
func (s InputPeerPhotoFileLocationLegacyArray ) Sort (less func (a , b InputPeerPhotoFileLocationLegacy ) bool ) InputPeerPhotoFileLocationLegacyArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s InputPeerPhotoFileLocationLegacyArray ) SortStable (less func (a , b InputPeerPhotoFileLocationLegacy ) bool ) InputPeerPhotoFileLocationLegacyArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s InputPeerPhotoFileLocationLegacyArray ) Retain (keep func (x InputPeerPhotoFileLocationLegacy ) bool ) InputPeerPhotoFileLocationLegacyArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s InputPeerPhotoFileLocationLegacyArray ) First () (v InputPeerPhotoFileLocationLegacy , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s InputPeerPhotoFileLocationLegacyArray ) Last () (v InputPeerPhotoFileLocationLegacy , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *InputPeerPhotoFileLocationLegacyArray ) PopFirst () (v InputPeerPhotoFileLocationLegacy , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero InputPeerPhotoFileLocationLegacy
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *InputPeerPhotoFileLocationLegacyArray ) Pop () (v InputPeerPhotoFileLocationLegacy , 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 InputStickerSetThumbLegacyArray []InputStickerSetThumbLegacy
func (s InputStickerSetThumbLegacyArray ) Sort (less func (a , b InputStickerSetThumbLegacy ) bool ) InputStickerSetThumbLegacyArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s InputStickerSetThumbLegacyArray ) SortStable (less func (a , b InputStickerSetThumbLegacy ) bool ) InputStickerSetThumbLegacyArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s InputStickerSetThumbLegacyArray ) Retain (keep func (x InputStickerSetThumbLegacy ) bool ) InputStickerSetThumbLegacyArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s InputStickerSetThumbLegacyArray ) First () (v InputStickerSetThumbLegacy , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s InputStickerSetThumbLegacyArray ) Last () (v InputStickerSetThumbLegacy , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *InputStickerSetThumbLegacyArray ) PopFirst () (v InputStickerSetThumbLegacy , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero InputStickerSetThumbLegacy
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *InputStickerSetThumbLegacyArray ) Pop () (v InputStickerSetThumbLegacy , 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 .