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 InputEncryptedFileClassArray []InputEncryptedFileClass
func (s InputEncryptedFileClassArray ) Sort (less func (a , b InputEncryptedFileClass ) bool ) InputEncryptedFileClassArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s InputEncryptedFileClassArray ) SortStable (less func (a , b InputEncryptedFileClass ) bool ) InputEncryptedFileClassArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s InputEncryptedFileClassArray ) Retain (keep func (x InputEncryptedFileClass ) bool ) InputEncryptedFileClassArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s InputEncryptedFileClassArray ) First () (v InputEncryptedFileClass , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s InputEncryptedFileClassArray ) Last () (v InputEncryptedFileClass , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *InputEncryptedFileClassArray ) PopFirst () (v InputEncryptedFileClass , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero InputEncryptedFileClass
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *InputEncryptedFileClassArray ) Pop () (v InputEncryptedFileClass , 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 InputEncryptedFileClassArray ) AsInputEncryptedFileUploaded () (to InputEncryptedFileUploadedArray ) {
for _ , elem := range s {
value , ok := elem .(*InputEncryptedFileUploaded )
if !ok {
continue
}
to = append (to , *value )
}
return to
}
func (s InputEncryptedFileClassArray ) AsInputEncryptedFile () (to InputEncryptedFileArray ) {
for _ , elem := range s {
value , ok := elem .(*InputEncryptedFile )
if !ok {
continue
}
to = append (to , *value )
}
return to
}
func (s InputEncryptedFileClassArray ) AsInputEncryptedFileBigUploaded () (to InputEncryptedFileBigUploadedArray ) {
for _ , elem := range s {
value , ok := elem .(*InputEncryptedFileBigUploaded )
if !ok {
continue
}
to = append (to , *value )
}
return to
}
func (s InputEncryptedFileClassArray ) FillNotEmptyMap (to map [int64 ]NotEmptyInputEncryptedFile ) {
for _ , elem := range s {
value , ok := elem .AsNotEmpty ()
if !ok {
continue
}
to [value .GetID ()] = value
}
}
func (s InputEncryptedFileClassArray ) NotEmptyToMap () map [int64 ]NotEmptyInputEncryptedFile {
r := make (map [int64 ]NotEmptyInputEncryptedFile , len (s ))
s .FillNotEmptyMap (r )
return r
}
func (s InputEncryptedFileClassArray ) AppendOnlyNotEmpty (to []NotEmptyInputEncryptedFile ) []NotEmptyInputEncryptedFile {
for _ , elem := range s {
value , ok := elem .AsNotEmpty ()
if !ok {
continue
}
to = append (to , value )
}
return to
}
func (s InputEncryptedFileClassArray ) AsNotEmpty () (to []NotEmptyInputEncryptedFile ) {
return s .AppendOnlyNotEmpty (to )
}
func (s InputEncryptedFileClassArray ) FirstAsNotEmpty () (v NotEmptyInputEncryptedFile , ok bool ) {
value , ok := s .First ()
if !ok {
return
}
return value .AsNotEmpty ()
}
func (s InputEncryptedFileClassArray ) LastAsNotEmpty () (v NotEmptyInputEncryptedFile , ok bool ) {
value , ok := s .Last ()
if !ok {
return
}
return value .AsNotEmpty ()
}
func (s *InputEncryptedFileClassArray ) PopFirstAsNotEmpty () (v NotEmptyInputEncryptedFile , ok bool ) {
value , ok := s .PopFirst ()
if !ok {
return
}
return value .AsNotEmpty ()
}
func (s *InputEncryptedFileClassArray ) PopAsNotEmpty () (v NotEmptyInputEncryptedFile , ok bool ) {
value , ok := s .Pop ()
if !ok {
return
}
return value .AsNotEmpty ()
}
type InputEncryptedFileUploadedArray []InputEncryptedFileUploaded
func (s InputEncryptedFileUploadedArray ) Sort (less func (a , b InputEncryptedFileUploaded ) bool ) InputEncryptedFileUploadedArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s InputEncryptedFileUploadedArray ) SortStable (less func (a , b InputEncryptedFileUploaded ) bool ) InputEncryptedFileUploadedArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s InputEncryptedFileUploadedArray ) Retain (keep func (x InputEncryptedFileUploaded ) bool ) InputEncryptedFileUploadedArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s InputEncryptedFileUploadedArray ) First () (v InputEncryptedFileUploaded , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s InputEncryptedFileUploadedArray ) Last () (v InputEncryptedFileUploaded , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *InputEncryptedFileUploadedArray ) PopFirst () (v InputEncryptedFileUploaded , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero InputEncryptedFileUploaded
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *InputEncryptedFileUploadedArray ) Pop () (v InputEncryptedFileUploaded , 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 InputEncryptedFileUploadedArray ) SortByID () InputEncryptedFileUploadedArray {
return s .Sort (func (a , b InputEncryptedFileUploaded ) bool {
return a .GetID () < b .GetID ()
})
}
func (s InputEncryptedFileUploadedArray ) SortStableByID () InputEncryptedFileUploadedArray {
return s .SortStable (func (a , b InputEncryptedFileUploaded ) bool {
return a .GetID () < b .GetID ()
})
}
func (s InputEncryptedFileUploadedArray ) FillMap (to map [int64 ]InputEncryptedFileUploaded ) {
for _ , value := range s {
to [value .GetID ()] = value
}
}
func (s InputEncryptedFileUploadedArray ) ToMap () map [int64 ]InputEncryptedFileUploaded {
r := make (map [int64 ]InputEncryptedFileUploaded , len (s ))
s .FillMap (r )
return r
}
type InputEncryptedFileArray []InputEncryptedFile
func (s InputEncryptedFileArray ) Sort (less func (a , b InputEncryptedFile ) bool ) InputEncryptedFileArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s InputEncryptedFileArray ) SortStable (less func (a , b InputEncryptedFile ) bool ) InputEncryptedFileArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s InputEncryptedFileArray ) Retain (keep func (x InputEncryptedFile ) bool ) InputEncryptedFileArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s InputEncryptedFileArray ) First () (v InputEncryptedFile , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s InputEncryptedFileArray ) Last () (v InputEncryptedFile , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *InputEncryptedFileArray ) PopFirst () (v InputEncryptedFile , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero InputEncryptedFile
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *InputEncryptedFileArray ) Pop () (v InputEncryptedFile , 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 InputEncryptedFileArray ) SortByID () InputEncryptedFileArray {
return s .Sort (func (a , b InputEncryptedFile ) bool {
return a .GetID () < b .GetID ()
})
}
func (s InputEncryptedFileArray ) SortStableByID () InputEncryptedFileArray {
return s .SortStable (func (a , b InputEncryptedFile ) bool {
return a .GetID () < b .GetID ()
})
}
func (s InputEncryptedFileArray ) FillMap (to map [int64 ]InputEncryptedFile ) {
for _ , value := range s {
to [value .GetID ()] = value
}
}
func (s InputEncryptedFileArray ) ToMap () map [int64 ]InputEncryptedFile {
r := make (map [int64 ]InputEncryptedFile , len (s ))
s .FillMap (r )
return r
}
type InputEncryptedFileBigUploadedArray []InputEncryptedFileBigUploaded
func (s InputEncryptedFileBigUploadedArray ) Sort (less func (a , b InputEncryptedFileBigUploaded ) bool ) InputEncryptedFileBigUploadedArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s InputEncryptedFileBigUploadedArray ) SortStable (less func (a , b InputEncryptedFileBigUploaded ) bool ) InputEncryptedFileBigUploadedArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s InputEncryptedFileBigUploadedArray ) Retain (keep func (x InputEncryptedFileBigUploaded ) bool ) InputEncryptedFileBigUploadedArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s InputEncryptedFileBigUploadedArray ) First () (v InputEncryptedFileBigUploaded , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s InputEncryptedFileBigUploadedArray ) Last () (v InputEncryptedFileBigUploaded , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *InputEncryptedFileBigUploadedArray ) PopFirst () (v InputEncryptedFileBigUploaded , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero InputEncryptedFileBigUploaded
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *InputEncryptedFileBigUploadedArray ) Pop () (v InputEncryptedFileBigUploaded , 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 InputEncryptedFileBigUploadedArray ) SortByID () InputEncryptedFileBigUploadedArray {
return s .Sort (func (a , b InputEncryptedFileBigUploaded ) bool {
return a .GetID () < b .GetID ()
})
}
func (s InputEncryptedFileBigUploadedArray ) SortStableByID () InputEncryptedFileBigUploadedArray {
return s .SortStable (func (a , b InputEncryptedFileBigUploaded ) bool {
return a .GetID () < b .GetID ()
})
}
func (s InputEncryptedFileBigUploadedArray ) FillMap (to map [int64 ]InputEncryptedFileBigUploaded ) {
for _ , value := range s {
to [value .GetID ()] = value
}
}
func (s InputEncryptedFileBigUploadedArray ) ToMap () map [int64 ]InputEncryptedFileBigUploaded {
r := make (map [int64 ]InputEncryptedFileBigUploaded , len (s ))
s .FillMap (r )
return r
}
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 .