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 StarGiftAttributeIDClassArray []StarGiftAttributeIDClass
func (s StarGiftAttributeIDClassArray ) Sort (less func (a , b StarGiftAttributeIDClass ) bool ) StarGiftAttributeIDClassArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s StarGiftAttributeIDClassArray ) SortStable (less func (a , b StarGiftAttributeIDClass ) bool ) StarGiftAttributeIDClassArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s StarGiftAttributeIDClassArray ) Retain (keep func (x StarGiftAttributeIDClass ) bool ) StarGiftAttributeIDClassArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s StarGiftAttributeIDClassArray ) First () (v StarGiftAttributeIDClass , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s StarGiftAttributeIDClassArray ) Last () (v StarGiftAttributeIDClass , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *StarGiftAttributeIDClassArray ) PopFirst () (v StarGiftAttributeIDClass , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero StarGiftAttributeIDClass
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *StarGiftAttributeIDClassArray ) Pop () (v StarGiftAttributeIDClass , 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 StarGiftAttributeIDClassArray ) AsStarGiftAttributeIDModel () (to StarGiftAttributeIDModelArray ) {
for _ , elem := range s {
value , ok := elem .(*StarGiftAttributeIDModel )
if !ok {
continue
}
to = append (to , *value )
}
return to
}
func (s StarGiftAttributeIDClassArray ) AsStarGiftAttributeIDPattern () (to StarGiftAttributeIDPatternArray ) {
for _ , elem := range s {
value , ok := elem .(*StarGiftAttributeIDPattern )
if !ok {
continue
}
to = append (to , *value )
}
return to
}
func (s StarGiftAttributeIDClassArray ) AsStarGiftAttributeIDBackdrop () (to StarGiftAttributeIDBackdropArray ) {
for _ , elem := range s {
value , ok := elem .(*StarGiftAttributeIDBackdrop )
if !ok {
continue
}
to = append (to , *value )
}
return to
}
type StarGiftAttributeIDModelArray []StarGiftAttributeIDModel
func (s StarGiftAttributeIDModelArray ) Sort (less func (a , b StarGiftAttributeIDModel ) bool ) StarGiftAttributeIDModelArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s StarGiftAttributeIDModelArray ) SortStable (less func (a , b StarGiftAttributeIDModel ) bool ) StarGiftAttributeIDModelArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s StarGiftAttributeIDModelArray ) Retain (keep func (x StarGiftAttributeIDModel ) bool ) StarGiftAttributeIDModelArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s StarGiftAttributeIDModelArray ) First () (v StarGiftAttributeIDModel , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s StarGiftAttributeIDModelArray ) Last () (v StarGiftAttributeIDModel , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *StarGiftAttributeIDModelArray ) PopFirst () (v StarGiftAttributeIDModel , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero StarGiftAttributeIDModel
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *StarGiftAttributeIDModelArray ) Pop () (v StarGiftAttributeIDModel , 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 StarGiftAttributeIDPatternArray []StarGiftAttributeIDPattern
func (s StarGiftAttributeIDPatternArray ) Sort (less func (a , b StarGiftAttributeIDPattern ) bool ) StarGiftAttributeIDPatternArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s StarGiftAttributeIDPatternArray ) SortStable (less func (a , b StarGiftAttributeIDPattern ) bool ) StarGiftAttributeIDPatternArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s StarGiftAttributeIDPatternArray ) Retain (keep func (x StarGiftAttributeIDPattern ) bool ) StarGiftAttributeIDPatternArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s StarGiftAttributeIDPatternArray ) First () (v StarGiftAttributeIDPattern , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s StarGiftAttributeIDPatternArray ) Last () (v StarGiftAttributeIDPattern , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *StarGiftAttributeIDPatternArray ) PopFirst () (v StarGiftAttributeIDPattern , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero StarGiftAttributeIDPattern
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *StarGiftAttributeIDPatternArray ) Pop () (v StarGiftAttributeIDPattern , 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 StarGiftAttributeIDBackdropArray []StarGiftAttributeIDBackdrop
func (s StarGiftAttributeIDBackdropArray ) Sort (less func (a , b StarGiftAttributeIDBackdrop ) bool ) StarGiftAttributeIDBackdropArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s StarGiftAttributeIDBackdropArray ) SortStable (less func (a , b StarGiftAttributeIDBackdrop ) bool ) StarGiftAttributeIDBackdropArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s StarGiftAttributeIDBackdropArray ) Retain (keep func (x StarGiftAttributeIDBackdrop ) bool ) StarGiftAttributeIDBackdropArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s StarGiftAttributeIDBackdropArray ) First () (v StarGiftAttributeIDBackdrop , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s StarGiftAttributeIDBackdropArray ) Last () (v StarGiftAttributeIDBackdrop , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *StarGiftAttributeIDBackdropArray ) PopFirst () (v StarGiftAttributeIDBackdrop , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero StarGiftAttributeIDBackdrop
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *StarGiftAttributeIDBackdropArray ) Pop () (v StarGiftAttributeIDBackdrop , 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.8.4 . (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 @zigo_101 (reachable from the left QR code) to get the latest news of Golds .