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 StarGiftAttributeClassArray []StarGiftAttributeClass
func (s StarGiftAttributeClassArray ) Sort (less func (a , b StarGiftAttributeClass ) bool ) StarGiftAttributeClassArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s StarGiftAttributeClassArray ) SortStable (less func (a , b StarGiftAttributeClass ) bool ) StarGiftAttributeClassArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s StarGiftAttributeClassArray ) Retain (keep func (x StarGiftAttributeClass ) bool ) StarGiftAttributeClassArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s StarGiftAttributeClassArray ) First () (v StarGiftAttributeClass , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s StarGiftAttributeClassArray ) Last () (v StarGiftAttributeClass , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *StarGiftAttributeClassArray ) PopFirst () (v StarGiftAttributeClass , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero StarGiftAttributeClass
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *StarGiftAttributeClassArray ) Pop () (v StarGiftAttributeClass , 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 StarGiftAttributeClassArray ) AsStarGiftAttributeModel () (to StarGiftAttributeModelArray ) {
for _ , elem := range s {
value , ok := elem .(*StarGiftAttributeModel )
if !ok {
continue
}
to = append (to , *value )
}
return to
}
func (s StarGiftAttributeClassArray ) AsStarGiftAttributePattern () (to StarGiftAttributePatternArray ) {
for _ , elem := range s {
value , ok := elem .(*StarGiftAttributePattern )
if !ok {
continue
}
to = append (to , *value )
}
return to
}
func (s StarGiftAttributeClassArray ) AsStarGiftAttributeBackdrop () (to StarGiftAttributeBackdropArray ) {
for _ , elem := range s {
value , ok := elem .(*StarGiftAttributeBackdrop )
if !ok {
continue
}
to = append (to , *value )
}
return to
}
func (s StarGiftAttributeClassArray ) AsStarGiftAttributeOriginalDetails () (to StarGiftAttributeOriginalDetailsArray ) {
for _ , elem := range s {
value , ok := elem .(*StarGiftAttributeOriginalDetails )
if !ok {
continue
}
to = append (to , *value )
}
return to
}
type StarGiftAttributeModelArray []StarGiftAttributeModel
func (s StarGiftAttributeModelArray ) Sort (less func (a , b StarGiftAttributeModel ) bool ) StarGiftAttributeModelArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s StarGiftAttributeModelArray ) SortStable (less func (a , b StarGiftAttributeModel ) bool ) StarGiftAttributeModelArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s StarGiftAttributeModelArray ) Retain (keep func (x StarGiftAttributeModel ) bool ) StarGiftAttributeModelArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s StarGiftAttributeModelArray ) First () (v StarGiftAttributeModel , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s StarGiftAttributeModelArray ) Last () (v StarGiftAttributeModel , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *StarGiftAttributeModelArray ) PopFirst () (v StarGiftAttributeModel , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero StarGiftAttributeModel
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *StarGiftAttributeModelArray ) Pop () (v StarGiftAttributeModel , 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 StarGiftAttributePatternArray []StarGiftAttributePattern
func (s StarGiftAttributePatternArray ) Sort (less func (a , b StarGiftAttributePattern ) bool ) StarGiftAttributePatternArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s StarGiftAttributePatternArray ) SortStable (less func (a , b StarGiftAttributePattern ) bool ) StarGiftAttributePatternArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s StarGiftAttributePatternArray ) Retain (keep func (x StarGiftAttributePattern ) bool ) StarGiftAttributePatternArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s StarGiftAttributePatternArray ) First () (v StarGiftAttributePattern , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s StarGiftAttributePatternArray ) Last () (v StarGiftAttributePattern , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *StarGiftAttributePatternArray ) PopFirst () (v StarGiftAttributePattern , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero StarGiftAttributePattern
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *StarGiftAttributePatternArray ) Pop () (v StarGiftAttributePattern , 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 StarGiftAttributeBackdropArray []StarGiftAttributeBackdrop
func (s StarGiftAttributeBackdropArray ) Sort (less func (a , b StarGiftAttributeBackdrop ) bool ) StarGiftAttributeBackdropArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s StarGiftAttributeBackdropArray ) SortStable (less func (a , b StarGiftAttributeBackdrop ) bool ) StarGiftAttributeBackdropArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s StarGiftAttributeBackdropArray ) Retain (keep func (x StarGiftAttributeBackdrop ) bool ) StarGiftAttributeBackdropArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s StarGiftAttributeBackdropArray ) First () (v StarGiftAttributeBackdrop , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s StarGiftAttributeBackdropArray ) Last () (v StarGiftAttributeBackdrop , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *StarGiftAttributeBackdropArray ) PopFirst () (v StarGiftAttributeBackdrop , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero StarGiftAttributeBackdrop
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *StarGiftAttributeBackdropArray ) Pop () (v StarGiftAttributeBackdrop , 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 StarGiftAttributeOriginalDetailsArray []StarGiftAttributeOriginalDetails
func (s StarGiftAttributeOriginalDetailsArray ) Sort (less func (a , b StarGiftAttributeOriginalDetails ) bool ) StarGiftAttributeOriginalDetailsArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s StarGiftAttributeOriginalDetailsArray ) SortStable (less func (a , b StarGiftAttributeOriginalDetails ) bool ) StarGiftAttributeOriginalDetailsArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s StarGiftAttributeOriginalDetailsArray ) Retain (keep func (x StarGiftAttributeOriginalDetails ) bool ) StarGiftAttributeOriginalDetailsArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s StarGiftAttributeOriginalDetailsArray ) First () (v StarGiftAttributeOriginalDetails , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s StarGiftAttributeOriginalDetailsArray ) Last () (v StarGiftAttributeOriginalDetails , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *StarGiftAttributeOriginalDetailsArray ) PopFirst () (v StarGiftAttributeOriginalDetails , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero StarGiftAttributeOriginalDetails
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *StarGiftAttributeOriginalDetailsArray ) Pop () (v StarGiftAttributeOriginalDetails , 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 StarGiftAttributeOriginalDetailsArray ) SortByDate () StarGiftAttributeOriginalDetailsArray {
return s .Sort (func (a , b StarGiftAttributeOriginalDetails ) bool {
return a .GetDate () < b .GetDate ()
})
}
func (s StarGiftAttributeOriginalDetailsArray ) SortStableByDate () StarGiftAttributeOriginalDetailsArray {
return s .SortStable (func (a , b StarGiftAttributeOriginalDetails ) bool {
return a .GetDate () < b .GetDate ()
})
}
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 .