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 PrepaidGiveawayClassArray []PrepaidGiveawayClass
func (s PrepaidGiveawayClassArray ) Sort (less func (a , b PrepaidGiveawayClass ) bool ) PrepaidGiveawayClassArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s PrepaidGiveawayClassArray ) SortStable (less func (a , b PrepaidGiveawayClass ) bool ) PrepaidGiveawayClassArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s PrepaidGiveawayClassArray ) Retain (keep func (x PrepaidGiveawayClass ) bool ) PrepaidGiveawayClassArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s PrepaidGiveawayClassArray ) First () (v PrepaidGiveawayClass , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s PrepaidGiveawayClassArray ) Last () (v PrepaidGiveawayClass , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *PrepaidGiveawayClassArray ) PopFirst () (v PrepaidGiveawayClass , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero PrepaidGiveawayClass
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *PrepaidGiveawayClassArray ) Pop () (v PrepaidGiveawayClass , 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 PrepaidGiveawayClassArray ) SortByID () PrepaidGiveawayClassArray {
return s .Sort (func (a , b PrepaidGiveawayClass ) bool {
return a .GetID () < b .GetID ()
})
}
func (s PrepaidGiveawayClassArray ) SortStableByID () PrepaidGiveawayClassArray {
return s .SortStable (func (a , b PrepaidGiveawayClass ) bool {
return a .GetID () < b .GetID ()
})
}
func (s PrepaidGiveawayClassArray ) SortByDate () PrepaidGiveawayClassArray {
return s .Sort (func (a , b PrepaidGiveawayClass ) bool {
return a .GetDate () < b .GetDate ()
})
}
func (s PrepaidGiveawayClassArray ) SortStableByDate () PrepaidGiveawayClassArray {
return s .SortStable (func (a , b PrepaidGiveawayClass ) bool {
return a .GetDate () < b .GetDate ()
})
}
func (s PrepaidGiveawayClassArray ) FillPrepaidGiveawayMap (to map [int64 ]*PrepaidGiveaway ) {
for _ , elem := range s {
value , ok := elem .(*PrepaidGiveaway )
if !ok {
continue
}
to [value .GetID ()] = value
}
}
func (s PrepaidGiveawayClassArray ) PrepaidGiveawayToMap () map [int64 ]*PrepaidGiveaway {
r := make (map [int64 ]*PrepaidGiveaway , len (s ))
s .FillPrepaidGiveawayMap (r )
return r
}
func (s PrepaidGiveawayClassArray ) AsPrepaidGiveaway () (to PrepaidGiveawayArray ) {
for _ , elem := range s {
value , ok := elem .(*PrepaidGiveaway )
if !ok {
continue
}
to = append (to , *value )
}
return to
}
func (s PrepaidGiveawayClassArray ) FillPrepaidStarsGiveawayMap (to map [int64 ]*PrepaidStarsGiveaway ) {
for _ , elem := range s {
value , ok := elem .(*PrepaidStarsGiveaway )
if !ok {
continue
}
to [value .GetID ()] = value
}
}
func (s PrepaidGiveawayClassArray ) PrepaidStarsGiveawayToMap () map [int64 ]*PrepaidStarsGiveaway {
r := make (map [int64 ]*PrepaidStarsGiveaway , len (s ))
s .FillPrepaidStarsGiveawayMap (r )
return r
}
func (s PrepaidGiveawayClassArray ) AsPrepaidStarsGiveaway () (to PrepaidStarsGiveawayArray ) {
for _ , elem := range s {
value , ok := elem .(*PrepaidStarsGiveaway )
if !ok {
continue
}
to = append (to , *value )
}
return to
}
type PrepaidGiveawayArray []PrepaidGiveaway
func (s PrepaidGiveawayArray ) Sort (less func (a , b PrepaidGiveaway ) bool ) PrepaidGiveawayArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s PrepaidGiveawayArray ) SortStable (less func (a , b PrepaidGiveaway ) bool ) PrepaidGiveawayArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s PrepaidGiveawayArray ) Retain (keep func (x PrepaidGiveaway ) bool ) PrepaidGiveawayArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s PrepaidGiveawayArray ) First () (v PrepaidGiveaway , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s PrepaidGiveawayArray ) Last () (v PrepaidGiveaway , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *PrepaidGiveawayArray ) PopFirst () (v PrepaidGiveaway , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero PrepaidGiveaway
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *PrepaidGiveawayArray ) Pop () (v PrepaidGiveaway , 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 PrepaidGiveawayArray ) SortByID () PrepaidGiveawayArray {
return s .Sort (func (a , b PrepaidGiveaway ) bool {
return a .GetID () < b .GetID ()
})
}
func (s PrepaidGiveawayArray ) SortStableByID () PrepaidGiveawayArray {
return s .SortStable (func (a , b PrepaidGiveaway ) bool {
return a .GetID () < b .GetID ()
})
}
func (s PrepaidGiveawayArray ) SortByDate () PrepaidGiveawayArray {
return s .Sort (func (a , b PrepaidGiveaway ) bool {
return a .GetDate () < b .GetDate ()
})
}
func (s PrepaidGiveawayArray ) SortStableByDate () PrepaidGiveawayArray {
return s .SortStable (func (a , b PrepaidGiveaway ) bool {
return a .GetDate () < b .GetDate ()
})
}
func (s PrepaidGiveawayArray ) FillMap (to map [int64 ]PrepaidGiveaway ) {
for _ , value := range s {
to [value .GetID ()] = value
}
}
func (s PrepaidGiveawayArray ) ToMap () map [int64 ]PrepaidGiveaway {
r := make (map [int64 ]PrepaidGiveaway , len (s ))
s .FillMap (r )
return r
}
type PrepaidStarsGiveawayArray []PrepaidStarsGiveaway
func (s PrepaidStarsGiveawayArray ) Sort (less func (a , b PrepaidStarsGiveaway ) bool ) PrepaidStarsGiveawayArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s PrepaidStarsGiveawayArray ) SortStable (less func (a , b PrepaidStarsGiveaway ) bool ) PrepaidStarsGiveawayArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s PrepaidStarsGiveawayArray ) Retain (keep func (x PrepaidStarsGiveaway ) bool ) PrepaidStarsGiveawayArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s PrepaidStarsGiveawayArray ) First () (v PrepaidStarsGiveaway , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s PrepaidStarsGiveawayArray ) Last () (v PrepaidStarsGiveaway , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *PrepaidStarsGiveawayArray ) PopFirst () (v PrepaidStarsGiveaway , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero PrepaidStarsGiveaway
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *PrepaidStarsGiveawayArray ) Pop () (v PrepaidStarsGiveaway , 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 PrepaidStarsGiveawayArray ) SortByID () PrepaidStarsGiveawayArray {
return s .Sort (func (a , b PrepaidStarsGiveaway ) bool {
return a .GetID () < b .GetID ()
})
}
func (s PrepaidStarsGiveawayArray ) SortStableByID () PrepaidStarsGiveawayArray {
return s .SortStable (func (a , b PrepaidStarsGiveaway ) bool {
return a .GetID () < b .GetID ()
})
}
func (s PrepaidStarsGiveawayArray ) SortByDate () PrepaidStarsGiveawayArray {
return s .Sort (func (a , b PrepaidStarsGiveaway ) bool {
return a .GetDate () < b .GetDate ()
})
}
func (s PrepaidStarsGiveawayArray ) SortStableByDate () PrepaidStarsGiveawayArray {
return s .SortStable (func (a , b PrepaidStarsGiveaway ) bool {
return a .GetDate () < b .GetDate ()
})
}
func (s PrepaidStarsGiveawayArray ) FillMap (to map [int64 ]PrepaidStarsGiveaway ) {
for _ , value := range s {
to [value .GetID ()] = value
}
}
func (s PrepaidStarsGiveawayArray ) ToMap () map [int64 ]PrepaidStarsGiveaway {
r := make (map [int64 ]PrepaidStarsGiveaway , len (s ))
s .FillMap (r )
return r
}
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 .