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 InputWallPaperClassArray []InputWallPaperClass
func (s InputWallPaperClassArray ) Sort (less func (a , b InputWallPaperClass ) bool ) InputWallPaperClassArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s InputWallPaperClassArray ) SortStable (less func (a , b InputWallPaperClass ) bool ) InputWallPaperClassArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s InputWallPaperClassArray ) Retain (keep func (x InputWallPaperClass ) bool ) InputWallPaperClassArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s InputWallPaperClassArray ) First () (v InputWallPaperClass , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s InputWallPaperClassArray ) Last () (v InputWallPaperClass , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *InputWallPaperClassArray ) PopFirst () (v InputWallPaperClass , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero InputWallPaperClass
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *InputWallPaperClassArray ) Pop () (v InputWallPaperClass , 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 InputWallPaperClassArray ) AsInputWallPaper () (to InputWallPaperArray ) {
for _ , elem := range s {
value , ok := elem .(*InputWallPaper )
if !ok {
continue
}
to = append (to , *value )
}
return to
}
func (s InputWallPaperClassArray ) AsInputWallPaperSlug () (to InputWallPaperSlugArray ) {
for _ , elem := range s {
value , ok := elem .(*InputWallPaperSlug )
if !ok {
continue
}
to = append (to , *value )
}
return to
}
func (s InputWallPaperClassArray ) AsInputWallPaperNoFile () (to InputWallPaperNoFileArray ) {
for _ , elem := range s {
value , ok := elem .(*InputWallPaperNoFile )
if !ok {
continue
}
to = append (to , *value )
}
return to
}
type InputWallPaperArray []InputWallPaper
func (s InputWallPaperArray ) Sort (less func (a , b InputWallPaper ) bool ) InputWallPaperArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s InputWallPaperArray ) SortStable (less func (a , b InputWallPaper ) bool ) InputWallPaperArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s InputWallPaperArray ) Retain (keep func (x InputWallPaper ) bool ) InputWallPaperArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s InputWallPaperArray ) First () (v InputWallPaper , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s InputWallPaperArray ) Last () (v InputWallPaper , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *InputWallPaperArray ) PopFirst () (v InputWallPaper , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero InputWallPaper
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *InputWallPaperArray ) Pop () (v InputWallPaper , 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 InputWallPaperArray ) SortByID () InputWallPaperArray {
return s .Sort (func (a , b InputWallPaper ) bool {
return a .GetID () < b .GetID ()
})
}
func (s InputWallPaperArray ) SortStableByID () InputWallPaperArray {
return s .SortStable (func (a , b InputWallPaper ) bool {
return a .GetID () < b .GetID ()
})
}
func (s InputWallPaperArray ) FillMap (to map [int64 ]InputWallPaper ) {
for _ , value := range s {
to [value .GetID ()] = value
}
}
func (s InputWallPaperArray ) ToMap () map [int64 ]InputWallPaper {
r := make (map [int64 ]InputWallPaper , len (s ))
s .FillMap (r )
return r
}
type InputWallPaperSlugArray []InputWallPaperSlug
func (s InputWallPaperSlugArray ) Sort (less func (a , b InputWallPaperSlug ) bool ) InputWallPaperSlugArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s InputWallPaperSlugArray ) SortStable (less func (a , b InputWallPaperSlug ) bool ) InputWallPaperSlugArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s InputWallPaperSlugArray ) Retain (keep func (x InputWallPaperSlug ) bool ) InputWallPaperSlugArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s InputWallPaperSlugArray ) First () (v InputWallPaperSlug , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s InputWallPaperSlugArray ) Last () (v InputWallPaperSlug , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *InputWallPaperSlugArray ) PopFirst () (v InputWallPaperSlug , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero InputWallPaperSlug
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *InputWallPaperSlugArray ) Pop () (v InputWallPaperSlug , 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 InputWallPaperNoFileArray []InputWallPaperNoFile
func (s InputWallPaperNoFileArray ) Sort (less func (a , b InputWallPaperNoFile ) bool ) InputWallPaperNoFileArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s InputWallPaperNoFileArray ) SortStable (less func (a , b InputWallPaperNoFile ) bool ) InputWallPaperNoFileArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s InputWallPaperNoFileArray ) Retain (keep func (x InputWallPaperNoFile ) bool ) InputWallPaperNoFileArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s InputWallPaperNoFileArray ) First () (v InputWallPaperNoFile , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s InputWallPaperNoFileArray ) Last () (v InputWallPaperNoFile , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *InputWallPaperNoFileArray ) PopFirst () (v InputWallPaperNoFile , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero InputWallPaperNoFile
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *InputWallPaperNoFileArray ) Pop () (v InputWallPaperNoFile , 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 InputWallPaperNoFileArray ) SortByID () InputWallPaperNoFileArray {
return s .Sort (func (a , b InputWallPaperNoFile ) bool {
return a .GetID () < b .GetID ()
})
}
func (s InputWallPaperNoFileArray ) SortStableByID () InputWallPaperNoFileArray {
return s .SortStable (func (a , b InputWallPaperNoFile ) bool {
return a .GetID () < b .GetID ()
})
}
func (s InputWallPaperNoFileArray ) FillMap (to map [int64 ]InputWallPaperNoFile ) {
for _ , value := range s {
to [value .GetID ()] = value
}
}
func (s InputWallPaperNoFileArray ) ToMap () map [int64 ]InputWallPaperNoFile {
r := make (map [int64 ]InputWallPaperNoFile , 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 .