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 InputSecureFileClassArray []InputSecureFileClass
func (s InputSecureFileClassArray ) Sort (less func (a , b InputSecureFileClass ) bool ) InputSecureFileClassArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s InputSecureFileClassArray ) SortStable (less func (a , b InputSecureFileClass ) bool ) InputSecureFileClassArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s InputSecureFileClassArray ) Retain (keep func (x InputSecureFileClass ) bool ) InputSecureFileClassArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s InputSecureFileClassArray ) First () (v InputSecureFileClass , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s InputSecureFileClassArray ) Last () (v InputSecureFileClass , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *InputSecureFileClassArray ) PopFirst () (v InputSecureFileClass , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero InputSecureFileClass
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *InputSecureFileClassArray ) Pop () (v InputSecureFileClass , 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 InputSecureFileClassArray ) SortByID () InputSecureFileClassArray {
return s .Sort (func (a , b InputSecureFileClass ) bool {
return a .GetID () < b .GetID ()
})
}
func (s InputSecureFileClassArray ) SortStableByID () InputSecureFileClassArray {
return s .SortStable (func (a , b InputSecureFileClass ) bool {
return a .GetID () < b .GetID ()
})
}
func (s InputSecureFileClassArray ) FillInputSecureFileUploadedMap (to map [int64 ]*InputSecureFileUploaded ) {
for _ , elem := range s {
value , ok := elem .(*InputSecureFileUploaded )
if !ok {
continue
}
to [value .GetID ()] = value
}
}
func (s InputSecureFileClassArray ) InputSecureFileUploadedToMap () map [int64 ]*InputSecureFileUploaded {
r := make (map [int64 ]*InputSecureFileUploaded , len (s ))
s .FillInputSecureFileUploadedMap (r )
return r
}
func (s InputSecureFileClassArray ) AsInputSecureFileUploaded () (to InputSecureFileUploadedArray ) {
for _ , elem := range s {
value , ok := elem .(*InputSecureFileUploaded )
if !ok {
continue
}
to = append (to , *value )
}
return to
}
func (s InputSecureFileClassArray ) FillInputSecureFileMap (to map [int64 ]*InputSecureFile ) {
for _ , elem := range s {
value , ok := elem .(*InputSecureFile )
if !ok {
continue
}
to [value .GetID ()] = value
}
}
func (s InputSecureFileClassArray ) InputSecureFileToMap () map [int64 ]*InputSecureFile {
r := make (map [int64 ]*InputSecureFile , len (s ))
s .FillInputSecureFileMap (r )
return r
}
func (s InputSecureFileClassArray ) AsInputSecureFile () (to InputSecureFileArray ) {
for _ , elem := range s {
value , ok := elem .(*InputSecureFile )
if !ok {
continue
}
to = append (to , *value )
}
return to
}
type InputSecureFileUploadedArray []InputSecureFileUploaded
func (s InputSecureFileUploadedArray ) Sort (less func (a , b InputSecureFileUploaded ) bool ) InputSecureFileUploadedArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s InputSecureFileUploadedArray ) SortStable (less func (a , b InputSecureFileUploaded ) bool ) InputSecureFileUploadedArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s InputSecureFileUploadedArray ) Retain (keep func (x InputSecureFileUploaded ) bool ) InputSecureFileUploadedArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s InputSecureFileUploadedArray ) First () (v InputSecureFileUploaded , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s InputSecureFileUploadedArray ) Last () (v InputSecureFileUploaded , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *InputSecureFileUploadedArray ) PopFirst () (v InputSecureFileUploaded , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero InputSecureFileUploaded
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *InputSecureFileUploadedArray ) Pop () (v InputSecureFileUploaded , 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 InputSecureFileUploadedArray ) SortByID () InputSecureFileUploadedArray {
return s .Sort (func (a , b InputSecureFileUploaded ) bool {
return a .GetID () < b .GetID ()
})
}
func (s InputSecureFileUploadedArray ) SortStableByID () InputSecureFileUploadedArray {
return s .SortStable (func (a , b InputSecureFileUploaded ) bool {
return a .GetID () < b .GetID ()
})
}
func (s InputSecureFileUploadedArray ) FillMap (to map [int64 ]InputSecureFileUploaded ) {
for _ , value := range s {
to [value .GetID ()] = value
}
}
func (s InputSecureFileUploadedArray ) ToMap () map [int64 ]InputSecureFileUploaded {
r := make (map [int64 ]InputSecureFileUploaded , len (s ))
s .FillMap (r )
return r
}
type InputSecureFileArray []InputSecureFile
func (s InputSecureFileArray ) Sort (less func (a , b InputSecureFile ) bool ) InputSecureFileArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s InputSecureFileArray ) SortStable (less func (a , b InputSecureFile ) bool ) InputSecureFileArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s InputSecureFileArray ) Retain (keep func (x InputSecureFile ) bool ) InputSecureFileArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s InputSecureFileArray ) First () (v InputSecureFile , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s InputSecureFileArray ) Last () (v InputSecureFile , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *InputSecureFileArray ) PopFirst () (v InputSecureFile , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero InputSecureFile
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *InputSecureFileArray ) Pop () (v InputSecureFile , 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 InputSecureFileArray ) SortByID () InputSecureFileArray {
return s .Sort (func (a , b InputSecureFile ) bool {
return a .GetID () < b .GetID ()
})
}
func (s InputSecureFileArray ) SortStableByID () InputSecureFileArray {
return s .SortStable (func (a , b InputSecureFile ) bool {
return a .GetID () < b .GetID ()
})
}
func (s InputSecureFileArray ) FillMap (to map [int64 ]InputSecureFile ) {
for _ , value := range s {
to [value .GetID ()] = value
}
}
func (s InputSecureFileArray ) ToMap () map [int64 ]InputSecureFile {
r := make (map [int64 ]InputSecureFile , 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 .