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 MessageMediaClassArray []MessageMediaClass
func (s MessageMediaClassArray ) Sort (less func (a , b MessageMediaClass ) bool ) MessageMediaClassArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s MessageMediaClassArray ) SortStable (less func (a , b MessageMediaClass ) bool ) MessageMediaClassArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s MessageMediaClassArray ) Retain (keep func (x MessageMediaClass ) bool ) MessageMediaClassArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s MessageMediaClassArray ) First () (v MessageMediaClass , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s MessageMediaClassArray ) Last () (v MessageMediaClass , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *MessageMediaClassArray ) PopFirst () (v MessageMediaClass , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero MessageMediaClass
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *MessageMediaClassArray ) Pop () (v MessageMediaClass , 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 MessageMediaClassArray ) AsMessageMediaPhoto () (to MessageMediaPhotoArray ) {
for _ , elem := range s {
value , ok := elem .(*MessageMediaPhoto )
if !ok {
continue
}
to = append (to , *value )
}
return to
}
func (s MessageMediaClassArray ) AsMessageMediaGeo () (to MessageMediaGeoArray ) {
for _ , elem := range s {
value , ok := elem .(*MessageMediaGeo )
if !ok {
continue
}
to = append (to , *value )
}
return to
}
func (s MessageMediaClassArray ) AsMessageMediaContact () (to MessageMediaContactArray ) {
for _ , elem := range s {
value , ok := elem .(*MessageMediaContact )
if !ok {
continue
}
to = append (to , *value )
}
return to
}
func (s MessageMediaClassArray ) AsMessageMediaDocument () (to MessageMediaDocumentArray ) {
for _ , elem := range s {
value , ok := elem .(*MessageMediaDocument )
if !ok {
continue
}
to = append (to , *value )
}
return to
}
func (s MessageMediaClassArray ) AsMessageMediaWebPage () (to MessageMediaWebPageArray ) {
for _ , elem := range s {
value , ok := elem .(*MessageMediaWebPage )
if !ok {
continue
}
to = append (to , *value )
}
return to
}
func (s MessageMediaClassArray ) AsMessageMediaVenue () (to MessageMediaVenueArray ) {
for _ , elem := range s {
value , ok := elem .(*MessageMediaVenue )
if !ok {
continue
}
to = append (to , *value )
}
return to
}
func (s MessageMediaClassArray ) AsMessageMediaGame () (to MessageMediaGameArray ) {
for _ , elem := range s {
value , ok := elem .(*MessageMediaGame )
if !ok {
continue
}
to = append (to , *value )
}
return to
}
func (s MessageMediaClassArray ) AsMessageMediaInvoice () (to MessageMediaInvoiceArray ) {
for _ , elem := range s {
value , ok := elem .(*MessageMediaInvoice )
if !ok {
continue
}
to = append (to , *value )
}
return to
}
func (s MessageMediaClassArray ) AsMessageMediaGeoLive () (to MessageMediaGeoLiveArray ) {
for _ , elem := range s {
value , ok := elem .(*MessageMediaGeoLive )
if !ok {
continue
}
to = append (to , *value )
}
return to
}
func (s MessageMediaClassArray ) AsMessageMediaPoll () (to MessageMediaPollArray ) {
for _ , elem := range s {
value , ok := elem .(*MessageMediaPoll )
if !ok {
continue
}
to = append (to , *value )
}
return to
}
func (s MessageMediaClassArray ) AsMessageMediaDice () (to MessageMediaDiceArray ) {
for _ , elem := range s {
value , ok := elem .(*MessageMediaDice )
if !ok {
continue
}
to = append (to , *value )
}
return to
}
func (s MessageMediaClassArray ) AsMessageMediaStory () (to MessageMediaStoryArray ) {
for _ , elem := range s {
value , ok := elem .(*MessageMediaStory )
if !ok {
continue
}
to = append (to , *value )
}
return to
}
func (s MessageMediaClassArray ) AsMessageMediaGiveaway () (to MessageMediaGiveawayArray ) {
for _ , elem := range s {
value , ok := elem .(*MessageMediaGiveaway )
if !ok {
continue
}
to = append (to , *value )
}
return to
}
func (s MessageMediaClassArray ) AsMessageMediaGiveawayResults () (to MessageMediaGiveawayResultsArray ) {
for _ , elem := range s {
value , ok := elem .(*MessageMediaGiveawayResults )
if !ok {
continue
}
to = append (to , *value )
}
return to
}
type MessageMediaPhotoArray []MessageMediaPhoto
func (s MessageMediaPhotoArray ) Sort (less func (a , b MessageMediaPhoto ) bool ) MessageMediaPhotoArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s MessageMediaPhotoArray ) SortStable (less func (a , b MessageMediaPhoto ) bool ) MessageMediaPhotoArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s MessageMediaPhotoArray ) Retain (keep func (x MessageMediaPhoto ) bool ) MessageMediaPhotoArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s MessageMediaPhotoArray ) First () (v MessageMediaPhoto , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s MessageMediaPhotoArray ) Last () (v MessageMediaPhoto , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *MessageMediaPhotoArray ) PopFirst () (v MessageMediaPhoto , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero MessageMediaPhoto
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *MessageMediaPhotoArray ) Pop () (v MessageMediaPhoto , 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 MessageMediaGeoArray []MessageMediaGeo
func (s MessageMediaGeoArray ) Sort (less func (a , b MessageMediaGeo ) bool ) MessageMediaGeoArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s MessageMediaGeoArray ) SortStable (less func (a , b MessageMediaGeo ) bool ) MessageMediaGeoArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s MessageMediaGeoArray ) Retain (keep func (x MessageMediaGeo ) bool ) MessageMediaGeoArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s MessageMediaGeoArray ) First () (v MessageMediaGeo , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s MessageMediaGeoArray ) Last () (v MessageMediaGeo , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *MessageMediaGeoArray ) PopFirst () (v MessageMediaGeo , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero MessageMediaGeo
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *MessageMediaGeoArray ) Pop () (v MessageMediaGeo , 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 MessageMediaContactArray []MessageMediaContact
func (s MessageMediaContactArray ) Sort (less func (a , b MessageMediaContact ) bool ) MessageMediaContactArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s MessageMediaContactArray ) SortStable (less func (a , b MessageMediaContact ) bool ) MessageMediaContactArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s MessageMediaContactArray ) Retain (keep func (x MessageMediaContact ) bool ) MessageMediaContactArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s MessageMediaContactArray ) First () (v MessageMediaContact , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s MessageMediaContactArray ) Last () (v MessageMediaContact , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *MessageMediaContactArray ) PopFirst () (v MessageMediaContact , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero MessageMediaContact
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *MessageMediaContactArray ) Pop () (v MessageMediaContact , 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 MessageMediaDocumentArray []MessageMediaDocument
func (s MessageMediaDocumentArray ) Sort (less func (a , b MessageMediaDocument ) bool ) MessageMediaDocumentArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s MessageMediaDocumentArray ) SortStable (less func (a , b MessageMediaDocument ) bool ) MessageMediaDocumentArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s MessageMediaDocumentArray ) Retain (keep func (x MessageMediaDocument ) bool ) MessageMediaDocumentArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s MessageMediaDocumentArray ) First () (v MessageMediaDocument , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s MessageMediaDocumentArray ) Last () (v MessageMediaDocument , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *MessageMediaDocumentArray ) PopFirst () (v MessageMediaDocument , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero MessageMediaDocument
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *MessageMediaDocumentArray ) Pop () (v MessageMediaDocument , 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 MessageMediaWebPageArray []MessageMediaWebPage
func (s MessageMediaWebPageArray ) Sort (less func (a , b MessageMediaWebPage ) bool ) MessageMediaWebPageArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s MessageMediaWebPageArray ) SortStable (less func (a , b MessageMediaWebPage ) bool ) MessageMediaWebPageArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s MessageMediaWebPageArray ) Retain (keep func (x MessageMediaWebPage ) bool ) MessageMediaWebPageArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s MessageMediaWebPageArray ) First () (v MessageMediaWebPage , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s MessageMediaWebPageArray ) Last () (v MessageMediaWebPage , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *MessageMediaWebPageArray ) PopFirst () (v MessageMediaWebPage , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero MessageMediaWebPage
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *MessageMediaWebPageArray ) Pop () (v MessageMediaWebPage , 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 MessageMediaVenueArray []MessageMediaVenue
func (s MessageMediaVenueArray ) Sort (less func (a , b MessageMediaVenue ) bool ) MessageMediaVenueArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s MessageMediaVenueArray ) SortStable (less func (a , b MessageMediaVenue ) bool ) MessageMediaVenueArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s MessageMediaVenueArray ) Retain (keep func (x MessageMediaVenue ) bool ) MessageMediaVenueArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s MessageMediaVenueArray ) First () (v MessageMediaVenue , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s MessageMediaVenueArray ) Last () (v MessageMediaVenue , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *MessageMediaVenueArray ) PopFirst () (v MessageMediaVenue , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero MessageMediaVenue
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *MessageMediaVenueArray ) Pop () (v MessageMediaVenue , 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 MessageMediaGameArray []MessageMediaGame
func (s MessageMediaGameArray ) Sort (less func (a , b MessageMediaGame ) bool ) MessageMediaGameArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s MessageMediaGameArray ) SortStable (less func (a , b MessageMediaGame ) bool ) MessageMediaGameArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s MessageMediaGameArray ) Retain (keep func (x MessageMediaGame ) bool ) MessageMediaGameArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s MessageMediaGameArray ) First () (v MessageMediaGame , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s MessageMediaGameArray ) Last () (v MessageMediaGame , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *MessageMediaGameArray ) PopFirst () (v MessageMediaGame , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero MessageMediaGame
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *MessageMediaGameArray ) Pop () (v MessageMediaGame , 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 MessageMediaInvoiceArray []MessageMediaInvoice
func (s MessageMediaInvoiceArray ) Sort (less func (a , b MessageMediaInvoice ) bool ) MessageMediaInvoiceArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s MessageMediaInvoiceArray ) SortStable (less func (a , b MessageMediaInvoice ) bool ) MessageMediaInvoiceArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s MessageMediaInvoiceArray ) Retain (keep func (x MessageMediaInvoice ) bool ) MessageMediaInvoiceArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s MessageMediaInvoiceArray ) First () (v MessageMediaInvoice , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s MessageMediaInvoiceArray ) Last () (v MessageMediaInvoice , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *MessageMediaInvoiceArray ) PopFirst () (v MessageMediaInvoice , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero MessageMediaInvoice
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *MessageMediaInvoiceArray ) Pop () (v MessageMediaInvoice , 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 MessageMediaGeoLiveArray []MessageMediaGeoLive
func (s MessageMediaGeoLiveArray ) Sort (less func (a , b MessageMediaGeoLive ) bool ) MessageMediaGeoLiveArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s MessageMediaGeoLiveArray ) SortStable (less func (a , b MessageMediaGeoLive ) bool ) MessageMediaGeoLiveArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s MessageMediaGeoLiveArray ) Retain (keep func (x MessageMediaGeoLive ) bool ) MessageMediaGeoLiveArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s MessageMediaGeoLiveArray ) First () (v MessageMediaGeoLive , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s MessageMediaGeoLiveArray ) Last () (v MessageMediaGeoLive , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *MessageMediaGeoLiveArray ) PopFirst () (v MessageMediaGeoLive , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero MessageMediaGeoLive
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *MessageMediaGeoLiveArray ) Pop () (v MessageMediaGeoLive , 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 MessageMediaPollArray []MessageMediaPoll
func (s MessageMediaPollArray ) Sort (less func (a , b MessageMediaPoll ) bool ) MessageMediaPollArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s MessageMediaPollArray ) SortStable (less func (a , b MessageMediaPoll ) bool ) MessageMediaPollArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s MessageMediaPollArray ) Retain (keep func (x MessageMediaPoll ) bool ) MessageMediaPollArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s MessageMediaPollArray ) First () (v MessageMediaPoll , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s MessageMediaPollArray ) Last () (v MessageMediaPoll , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *MessageMediaPollArray ) PopFirst () (v MessageMediaPoll , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero MessageMediaPoll
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *MessageMediaPollArray ) Pop () (v MessageMediaPoll , 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 MessageMediaDiceArray []MessageMediaDice
func (s MessageMediaDiceArray ) Sort (less func (a , b MessageMediaDice ) bool ) MessageMediaDiceArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s MessageMediaDiceArray ) SortStable (less func (a , b MessageMediaDice ) bool ) MessageMediaDiceArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s MessageMediaDiceArray ) Retain (keep func (x MessageMediaDice ) bool ) MessageMediaDiceArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s MessageMediaDiceArray ) First () (v MessageMediaDice , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s MessageMediaDiceArray ) Last () (v MessageMediaDice , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *MessageMediaDiceArray ) PopFirst () (v MessageMediaDice , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero MessageMediaDice
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *MessageMediaDiceArray ) Pop () (v MessageMediaDice , 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 MessageMediaStoryArray []MessageMediaStory
func (s MessageMediaStoryArray ) Sort (less func (a , b MessageMediaStory ) bool ) MessageMediaStoryArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s MessageMediaStoryArray ) SortStable (less func (a , b MessageMediaStory ) bool ) MessageMediaStoryArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s MessageMediaStoryArray ) Retain (keep func (x MessageMediaStory ) bool ) MessageMediaStoryArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s MessageMediaStoryArray ) First () (v MessageMediaStory , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s MessageMediaStoryArray ) Last () (v MessageMediaStory , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *MessageMediaStoryArray ) PopFirst () (v MessageMediaStory , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero MessageMediaStory
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *MessageMediaStoryArray ) Pop () (v MessageMediaStory , 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 MessageMediaStoryArray ) SortByID () MessageMediaStoryArray {
return s .Sort (func (a , b MessageMediaStory ) bool {
return a .GetID () < b .GetID ()
})
}
func (s MessageMediaStoryArray ) SortStableByID () MessageMediaStoryArray {
return s .SortStable (func (a , b MessageMediaStory ) bool {
return a .GetID () < b .GetID ()
})
}
func (s MessageMediaStoryArray ) FillMap (to map [int ]MessageMediaStory ) {
for _ , value := range s {
to [value .GetID ()] = value
}
}
func (s MessageMediaStoryArray ) ToMap () map [int ]MessageMediaStory {
r := make (map [int ]MessageMediaStory , len (s ))
s .FillMap (r )
return r
}
type MessageMediaGiveawayArray []MessageMediaGiveaway
func (s MessageMediaGiveawayArray ) Sort (less func (a , b MessageMediaGiveaway ) bool ) MessageMediaGiveawayArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s MessageMediaGiveawayArray ) SortStable (less func (a , b MessageMediaGiveaway ) bool ) MessageMediaGiveawayArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s MessageMediaGiveawayArray ) Retain (keep func (x MessageMediaGiveaway ) bool ) MessageMediaGiveawayArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s MessageMediaGiveawayArray ) First () (v MessageMediaGiveaway , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s MessageMediaGiveawayArray ) Last () (v MessageMediaGiveaway , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *MessageMediaGiveawayArray ) PopFirst () (v MessageMediaGiveaway , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero MessageMediaGiveaway
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *MessageMediaGiveawayArray ) Pop () (v MessageMediaGiveaway , 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 MessageMediaGiveawayResultsArray []MessageMediaGiveawayResults
func (s MessageMediaGiveawayResultsArray ) Sort (less func (a , b MessageMediaGiveawayResults ) bool ) MessageMediaGiveawayResultsArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s MessageMediaGiveawayResultsArray ) SortStable (less func (a , b MessageMediaGiveawayResults ) bool ) MessageMediaGiveawayResultsArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s MessageMediaGiveawayResultsArray ) Retain (keep func (x MessageMediaGiveawayResults ) bool ) MessageMediaGiveawayResultsArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s MessageMediaGiveawayResultsArray ) First () (v MessageMediaGiveawayResults , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s MessageMediaGiveawayResultsArray ) Last () (v MessageMediaGiveawayResults , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *MessageMediaGiveawayResultsArray ) PopFirst () (v MessageMediaGiveawayResults , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero MessageMediaGiveawayResults
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *MessageMediaGiveawayResultsArray ) Pop () (v MessageMediaGiveawayResults , 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 .