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 MediaAreaClassArray []MediaAreaClass
func (s MediaAreaClassArray ) Sort (less func (a , b MediaAreaClass ) bool ) MediaAreaClassArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s MediaAreaClassArray ) SortStable (less func (a , b MediaAreaClass ) bool ) MediaAreaClassArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s MediaAreaClassArray ) Retain (keep func (x MediaAreaClass ) bool ) MediaAreaClassArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s MediaAreaClassArray ) First () (v MediaAreaClass , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s MediaAreaClassArray ) Last () (v MediaAreaClass , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *MediaAreaClassArray ) PopFirst () (v MediaAreaClass , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero MediaAreaClass
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *MediaAreaClassArray ) Pop () (v MediaAreaClass , 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 MediaAreaClassArray ) AsMediaAreaVenue () (to MediaAreaVenueArray ) {
for _ , elem := range s {
value , ok := elem .(*MediaAreaVenue )
if !ok {
continue
}
to = append (to , *value )
}
return to
}
func (s MediaAreaClassArray ) AsInputMediaAreaVenue () (to InputMediaAreaVenueArray ) {
for _ , elem := range s {
value , ok := elem .(*InputMediaAreaVenue )
if !ok {
continue
}
to = append (to , *value )
}
return to
}
func (s MediaAreaClassArray ) AsMediaAreaGeoPoint () (to MediaAreaGeoPointArray ) {
for _ , elem := range s {
value , ok := elem .(*MediaAreaGeoPoint )
if !ok {
continue
}
to = append (to , *value )
}
return to
}
func (s MediaAreaClassArray ) AsMediaAreaSuggestedReaction () (to MediaAreaSuggestedReactionArray ) {
for _ , elem := range s {
value , ok := elem .(*MediaAreaSuggestedReaction )
if !ok {
continue
}
to = append (to , *value )
}
return to
}
func (s MediaAreaClassArray ) AsMediaAreaChannelPost () (to MediaAreaChannelPostArray ) {
for _ , elem := range s {
value , ok := elem .(*MediaAreaChannelPost )
if !ok {
continue
}
to = append (to , *value )
}
return to
}
func (s MediaAreaClassArray ) AsInputMediaAreaChannelPost () (to InputMediaAreaChannelPostArray ) {
for _ , elem := range s {
value , ok := elem .(*InputMediaAreaChannelPost )
if !ok {
continue
}
to = append (to , *value )
}
return to
}
type MediaAreaVenueArray []MediaAreaVenue
func (s MediaAreaVenueArray ) Sort (less func (a , b MediaAreaVenue ) bool ) MediaAreaVenueArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s MediaAreaVenueArray ) SortStable (less func (a , b MediaAreaVenue ) bool ) MediaAreaVenueArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s MediaAreaVenueArray ) Retain (keep func (x MediaAreaVenue ) bool ) MediaAreaVenueArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s MediaAreaVenueArray ) First () (v MediaAreaVenue , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s MediaAreaVenueArray ) Last () (v MediaAreaVenue , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *MediaAreaVenueArray ) PopFirst () (v MediaAreaVenue , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero MediaAreaVenue
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *MediaAreaVenueArray ) Pop () (v MediaAreaVenue , 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 InputMediaAreaVenueArray []InputMediaAreaVenue
func (s InputMediaAreaVenueArray ) Sort (less func (a , b InputMediaAreaVenue ) bool ) InputMediaAreaVenueArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s InputMediaAreaVenueArray ) SortStable (less func (a , b InputMediaAreaVenue ) bool ) InputMediaAreaVenueArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s InputMediaAreaVenueArray ) Retain (keep func (x InputMediaAreaVenue ) bool ) InputMediaAreaVenueArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s InputMediaAreaVenueArray ) First () (v InputMediaAreaVenue , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s InputMediaAreaVenueArray ) Last () (v InputMediaAreaVenue , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *InputMediaAreaVenueArray ) PopFirst () (v InputMediaAreaVenue , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero InputMediaAreaVenue
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *InputMediaAreaVenueArray ) Pop () (v InputMediaAreaVenue , 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 MediaAreaGeoPointArray []MediaAreaGeoPoint
func (s MediaAreaGeoPointArray ) Sort (less func (a , b MediaAreaGeoPoint ) bool ) MediaAreaGeoPointArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s MediaAreaGeoPointArray ) SortStable (less func (a , b MediaAreaGeoPoint ) bool ) MediaAreaGeoPointArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s MediaAreaGeoPointArray ) Retain (keep func (x MediaAreaGeoPoint ) bool ) MediaAreaGeoPointArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s MediaAreaGeoPointArray ) First () (v MediaAreaGeoPoint , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s MediaAreaGeoPointArray ) Last () (v MediaAreaGeoPoint , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *MediaAreaGeoPointArray ) PopFirst () (v MediaAreaGeoPoint , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero MediaAreaGeoPoint
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *MediaAreaGeoPointArray ) Pop () (v MediaAreaGeoPoint , 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 MediaAreaSuggestedReactionArray []MediaAreaSuggestedReaction
func (s MediaAreaSuggestedReactionArray ) Sort (less func (a , b MediaAreaSuggestedReaction ) bool ) MediaAreaSuggestedReactionArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s MediaAreaSuggestedReactionArray ) SortStable (less func (a , b MediaAreaSuggestedReaction ) bool ) MediaAreaSuggestedReactionArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s MediaAreaSuggestedReactionArray ) Retain (keep func (x MediaAreaSuggestedReaction ) bool ) MediaAreaSuggestedReactionArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s MediaAreaSuggestedReactionArray ) First () (v MediaAreaSuggestedReaction , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s MediaAreaSuggestedReactionArray ) Last () (v MediaAreaSuggestedReaction , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *MediaAreaSuggestedReactionArray ) PopFirst () (v MediaAreaSuggestedReaction , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero MediaAreaSuggestedReaction
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *MediaAreaSuggestedReactionArray ) Pop () (v MediaAreaSuggestedReaction , 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 MediaAreaChannelPostArray []MediaAreaChannelPost
func (s MediaAreaChannelPostArray ) Sort (less func (a , b MediaAreaChannelPost ) bool ) MediaAreaChannelPostArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s MediaAreaChannelPostArray ) SortStable (less func (a , b MediaAreaChannelPost ) bool ) MediaAreaChannelPostArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s MediaAreaChannelPostArray ) Retain (keep func (x MediaAreaChannelPost ) bool ) MediaAreaChannelPostArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s MediaAreaChannelPostArray ) First () (v MediaAreaChannelPost , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s MediaAreaChannelPostArray ) Last () (v MediaAreaChannelPost , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *MediaAreaChannelPostArray ) PopFirst () (v MediaAreaChannelPost , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero MediaAreaChannelPost
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *MediaAreaChannelPostArray ) Pop () (v MediaAreaChannelPost , 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 InputMediaAreaChannelPostArray []InputMediaAreaChannelPost
func (s InputMediaAreaChannelPostArray ) Sort (less func (a , b InputMediaAreaChannelPost ) bool ) InputMediaAreaChannelPostArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s InputMediaAreaChannelPostArray ) SortStable (less func (a , b InputMediaAreaChannelPost ) bool ) InputMediaAreaChannelPostArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s InputMediaAreaChannelPostArray ) Retain (keep func (x InputMediaAreaChannelPost ) bool ) InputMediaAreaChannelPostArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s InputMediaAreaChannelPostArray ) First () (v InputMediaAreaChannelPost , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s InputMediaAreaChannelPostArray ) Last () (v InputMediaAreaChannelPost , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *InputMediaAreaChannelPostArray ) PopFirst () (v InputMediaAreaChannelPost , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero InputMediaAreaChannelPost
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *InputMediaAreaChannelPostArray ) Pop () (v InputMediaAreaChannelPost , 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 .