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 PhotoSizeClassArray []PhotoSizeClass
func (s PhotoSizeClassArray ) Sort (less func (a , b PhotoSizeClass ) bool ) PhotoSizeClassArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s PhotoSizeClassArray ) SortStable (less func (a , b PhotoSizeClass ) bool ) PhotoSizeClassArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s PhotoSizeClassArray ) Retain (keep func (x PhotoSizeClass ) bool ) PhotoSizeClassArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s PhotoSizeClassArray ) First () (v PhotoSizeClass , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s PhotoSizeClassArray ) Last () (v PhotoSizeClass , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *PhotoSizeClassArray ) PopFirst () (v PhotoSizeClass , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero PhotoSizeClass
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *PhotoSizeClassArray ) Pop () (v PhotoSizeClass , 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 PhotoSizeClassArray ) AsPhotoSizeEmpty () (to PhotoSizeEmptyArray ) {
for _ , elem := range s {
value , ok := elem .(*PhotoSizeEmpty )
if !ok {
continue
}
to = append (to , *value )
}
return to
}
func (s PhotoSizeClassArray ) AsPhotoSize () (to PhotoSizeArray ) {
for _ , elem := range s {
value , ok := elem .(*PhotoSize )
if !ok {
continue
}
to = append (to , *value )
}
return to
}
func (s PhotoSizeClassArray ) AsPhotoCachedSize () (to PhotoCachedSizeArray ) {
for _ , elem := range s {
value , ok := elem .(*PhotoCachedSize )
if !ok {
continue
}
to = append (to , *value )
}
return to
}
func (s PhotoSizeClassArray ) AsPhotoStrippedSize () (to PhotoStrippedSizeArray ) {
for _ , elem := range s {
value , ok := elem .(*PhotoStrippedSize )
if !ok {
continue
}
to = append (to , *value )
}
return to
}
func (s PhotoSizeClassArray ) AsPhotoSizeProgressive () (to PhotoSizeProgressiveArray ) {
for _ , elem := range s {
value , ok := elem .(*PhotoSizeProgressive )
if !ok {
continue
}
to = append (to , *value )
}
return to
}
func (s PhotoSizeClassArray ) AsPhotoPathSize () (to PhotoPathSizeArray ) {
for _ , elem := range s {
value , ok := elem .(*PhotoPathSize )
if !ok {
continue
}
to = append (to , *value )
}
return to
}
func (s PhotoSizeClassArray ) AppendOnlyNotEmpty (to []NotEmptyPhotoSize ) []NotEmptyPhotoSize {
for _ , elem := range s {
value , ok := elem .AsNotEmpty ()
if !ok {
continue
}
to = append (to , value )
}
return to
}
func (s PhotoSizeClassArray ) AsNotEmpty () (to []NotEmptyPhotoSize ) {
return s .AppendOnlyNotEmpty (to )
}
func (s PhotoSizeClassArray ) FirstAsNotEmpty () (v NotEmptyPhotoSize , ok bool ) {
value , ok := s .First ()
if !ok {
return
}
return value .AsNotEmpty ()
}
func (s PhotoSizeClassArray ) LastAsNotEmpty () (v NotEmptyPhotoSize , ok bool ) {
value , ok := s .Last ()
if !ok {
return
}
return value .AsNotEmpty ()
}
func (s *PhotoSizeClassArray ) PopFirstAsNotEmpty () (v NotEmptyPhotoSize , ok bool ) {
value , ok := s .PopFirst ()
if !ok {
return
}
return value .AsNotEmpty ()
}
func (s *PhotoSizeClassArray ) PopAsNotEmpty () (v NotEmptyPhotoSize , ok bool ) {
value , ok := s .Pop ()
if !ok {
return
}
return value .AsNotEmpty ()
}
type PhotoSizeEmptyArray []PhotoSizeEmpty
func (s PhotoSizeEmptyArray ) Sort (less func (a , b PhotoSizeEmpty ) bool ) PhotoSizeEmptyArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s PhotoSizeEmptyArray ) SortStable (less func (a , b PhotoSizeEmpty ) bool ) PhotoSizeEmptyArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s PhotoSizeEmptyArray ) Retain (keep func (x PhotoSizeEmpty ) bool ) PhotoSizeEmptyArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s PhotoSizeEmptyArray ) First () (v PhotoSizeEmpty , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s PhotoSizeEmptyArray ) Last () (v PhotoSizeEmpty , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *PhotoSizeEmptyArray ) PopFirst () (v PhotoSizeEmpty , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero PhotoSizeEmpty
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *PhotoSizeEmptyArray ) Pop () (v PhotoSizeEmpty , 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 PhotoSizeArray []PhotoSize
func (s PhotoSizeArray ) Sort (less func (a , b PhotoSize ) bool ) PhotoSizeArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s PhotoSizeArray ) SortStable (less func (a , b PhotoSize ) bool ) PhotoSizeArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s PhotoSizeArray ) Retain (keep func (x PhotoSize ) bool ) PhotoSizeArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s PhotoSizeArray ) First () (v PhotoSize , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s PhotoSizeArray ) Last () (v PhotoSize , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *PhotoSizeArray ) PopFirst () (v PhotoSize , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero PhotoSize
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *PhotoSizeArray ) Pop () (v PhotoSize , 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 PhotoCachedSizeArray []PhotoCachedSize
func (s PhotoCachedSizeArray ) Sort (less func (a , b PhotoCachedSize ) bool ) PhotoCachedSizeArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s PhotoCachedSizeArray ) SortStable (less func (a , b PhotoCachedSize ) bool ) PhotoCachedSizeArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s PhotoCachedSizeArray ) Retain (keep func (x PhotoCachedSize ) bool ) PhotoCachedSizeArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s PhotoCachedSizeArray ) First () (v PhotoCachedSize , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s PhotoCachedSizeArray ) Last () (v PhotoCachedSize , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *PhotoCachedSizeArray ) PopFirst () (v PhotoCachedSize , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero PhotoCachedSize
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *PhotoCachedSizeArray ) Pop () (v PhotoCachedSize , 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 PhotoStrippedSizeArray []PhotoStrippedSize
func (s PhotoStrippedSizeArray ) Sort (less func (a , b PhotoStrippedSize ) bool ) PhotoStrippedSizeArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s PhotoStrippedSizeArray ) SortStable (less func (a , b PhotoStrippedSize ) bool ) PhotoStrippedSizeArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s PhotoStrippedSizeArray ) Retain (keep func (x PhotoStrippedSize ) bool ) PhotoStrippedSizeArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s PhotoStrippedSizeArray ) First () (v PhotoStrippedSize , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s PhotoStrippedSizeArray ) Last () (v PhotoStrippedSize , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *PhotoStrippedSizeArray ) PopFirst () (v PhotoStrippedSize , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero PhotoStrippedSize
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *PhotoStrippedSizeArray ) Pop () (v PhotoStrippedSize , 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 PhotoSizeProgressiveArray []PhotoSizeProgressive
func (s PhotoSizeProgressiveArray ) Sort (less func (a , b PhotoSizeProgressive ) bool ) PhotoSizeProgressiveArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s PhotoSizeProgressiveArray ) SortStable (less func (a , b PhotoSizeProgressive ) bool ) PhotoSizeProgressiveArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s PhotoSizeProgressiveArray ) Retain (keep func (x PhotoSizeProgressive ) bool ) PhotoSizeProgressiveArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s PhotoSizeProgressiveArray ) First () (v PhotoSizeProgressive , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s PhotoSizeProgressiveArray ) Last () (v PhotoSizeProgressive , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *PhotoSizeProgressiveArray ) PopFirst () (v PhotoSizeProgressive , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero PhotoSizeProgressive
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *PhotoSizeProgressiveArray ) Pop () (v PhotoSizeProgressive , 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 PhotoPathSizeArray []PhotoPathSize
func (s PhotoPathSizeArray ) Sort (less func (a , b PhotoPathSize ) bool ) PhotoPathSizeArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s PhotoPathSizeArray ) SortStable (less func (a , b PhotoPathSize ) bool ) PhotoPathSizeArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s PhotoPathSizeArray ) Retain (keep func (x PhotoPathSize ) bool ) PhotoPathSizeArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s PhotoPathSizeArray ) First () (v PhotoPathSize , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s PhotoPathSizeArray ) Last () (v PhotoPathSize , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *PhotoPathSizeArray ) PopFirst () (v PhotoPathSize , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero PhotoPathSize
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *PhotoPathSizeArray ) Pop () (v PhotoPathSize , 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 .