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 InputMediaClassArray []InputMediaClass
func (s InputMediaClassArray ) Sort (less func (a , b InputMediaClass ) bool ) InputMediaClassArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s InputMediaClassArray ) SortStable (less func (a , b InputMediaClass ) bool ) InputMediaClassArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s InputMediaClassArray ) Retain (keep func (x InputMediaClass ) bool ) InputMediaClassArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s InputMediaClassArray ) First () (v InputMediaClass , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s InputMediaClassArray ) Last () (v InputMediaClass , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *InputMediaClassArray ) PopFirst () (v InputMediaClass , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero InputMediaClass
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *InputMediaClassArray ) Pop () (v InputMediaClass , 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 InputMediaClassArray ) AsInputMediaUploadedPhoto () (to InputMediaUploadedPhotoArray ) {
for _ , elem := range s {
value , ok := elem .(*InputMediaUploadedPhoto )
if !ok {
continue
}
to = append (to , *value )
}
return to
}
func (s InputMediaClassArray ) AsInputMediaPhoto () (to InputMediaPhotoArray ) {
for _ , elem := range s {
value , ok := elem .(*InputMediaPhoto )
if !ok {
continue
}
to = append (to , *value )
}
return to
}
func (s InputMediaClassArray ) AsInputMediaGeoPoint () (to InputMediaGeoPointArray ) {
for _ , elem := range s {
value , ok := elem .(*InputMediaGeoPoint )
if !ok {
continue
}
to = append (to , *value )
}
return to
}
func (s InputMediaClassArray ) AsInputMediaContact () (to InputMediaContactArray ) {
for _ , elem := range s {
value , ok := elem .(*InputMediaContact )
if !ok {
continue
}
to = append (to , *value )
}
return to
}
func (s InputMediaClassArray ) AsInputMediaUploadedDocument () (to InputMediaUploadedDocumentArray ) {
for _ , elem := range s {
value , ok := elem .(*InputMediaUploadedDocument )
if !ok {
continue
}
to = append (to , *value )
}
return to
}
func (s InputMediaClassArray ) AsInputMediaDocument () (to InputMediaDocumentArray ) {
for _ , elem := range s {
value , ok := elem .(*InputMediaDocument )
if !ok {
continue
}
to = append (to , *value )
}
return to
}
func (s InputMediaClassArray ) AsInputMediaVenue () (to InputMediaVenueArray ) {
for _ , elem := range s {
value , ok := elem .(*InputMediaVenue )
if !ok {
continue
}
to = append (to , *value )
}
return to
}
func (s InputMediaClassArray ) AsInputMediaPhotoExternal () (to InputMediaPhotoExternalArray ) {
for _ , elem := range s {
value , ok := elem .(*InputMediaPhotoExternal )
if !ok {
continue
}
to = append (to , *value )
}
return to
}
func (s InputMediaClassArray ) AsInputMediaDocumentExternal () (to InputMediaDocumentExternalArray ) {
for _ , elem := range s {
value , ok := elem .(*InputMediaDocumentExternal )
if !ok {
continue
}
to = append (to , *value )
}
return to
}
func (s InputMediaClassArray ) AsInputMediaGame () (to InputMediaGameArray ) {
for _ , elem := range s {
value , ok := elem .(*InputMediaGame )
if !ok {
continue
}
to = append (to , *value )
}
return to
}
func (s InputMediaClassArray ) AsInputMediaInvoice () (to InputMediaInvoiceArray ) {
for _ , elem := range s {
value , ok := elem .(*InputMediaInvoice )
if !ok {
continue
}
to = append (to , *value )
}
return to
}
func (s InputMediaClassArray ) AsInputMediaGeoLive () (to InputMediaGeoLiveArray ) {
for _ , elem := range s {
value , ok := elem .(*InputMediaGeoLive )
if !ok {
continue
}
to = append (to , *value )
}
return to
}
func (s InputMediaClassArray ) AsInputMediaPoll () (to InputMediaPollArray ) {
for _ , elem := range s {
value , ok := elem .(*InputMediaPoll )
if !ok {
continue
}
to = append (to , *value )
}
return to
}
func (s InputMediaClassArray ) AsInputMediaDice () (to InputMediaDiceArray ) {
for _ , elem := range s {
value , ok := elem .(*InputMediaDice )
if !ok {
continue
}
to = append (to , *value )
}
return to
}
func (s InputMediaClassArray ) AsInputMediaStory () (to InputMediaStoryArray ) {
for _ , elem := range s {
value , ok := elem .(*InputMediaStory )
if !ok {
continue
}
to = append (to , *value )
}
return to
}
func (s InputMediaClassArray ) AsInputMediaWebPage () (to InputMediaWebPageArray ) {
for _ , elem := range s {
value , ok := elem .(*InputMediaWebPage )
if !ok {
continue
}
to = append (to , *value )
}
return to
}
type InputMediaUploadedPhotoArray []InputMediaUploadedPhoto
func (s InputMediaUploadedPhotoArray ) Sort (less func (a , b InputMediaUploadedPhoto ) bool ) InputMediaUploadedPhotoArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s InputMediaUploadedPhotoArray ) SortStable (less func (a , b InputMediaUploadedPhoto ) bool ) InputMediaUploadedPhotoArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s InputMediaUploadedPhotoArray ) Retain (keep func (x InputMediaUploadedPhoto ) bool ) InputMediaUploadedPhotoArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s InputMediaUploadedPhotoArray ) First () (v InputMediaUploadedPhoto , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s InputMediaUploadedPhotoArray ) Last () (v InputMediaUploadedPhoto , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *InputMediaUploadedPhotoArray ) PopFirst () (v InputMediaUploadedPhoto , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero InputMediaUploadedPhoto
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *InputMediaUploadedPhotoArray ) Pop () (v InputMediaUploadedPhoto , 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 InputMediaPhotoArray []InputMediaPhoto
func (s InputMediaPhotoArray ) Sort (less func (a , b InputMediaPhoto ) bool ) InputMediaPhotoArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s InputMediaPhotoArray ) SortStable (less func (a , b InputMediaPhoto ) bool ) InputMediaPhotoArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s InputMediaPhotoArray ) Retain (keep func (x InputMediaPhoto ) bool ) InputMediaPhotoArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s InputMediaPhotoArray ) First () (v InputMediaPhoto , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s InputMediaPhotoArray ) Last () (v InputMediaPhoto , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *InputMediaPhotoArray ) PopFirst () (v InputMediaPhoto , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero InputMediaPhoto
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *InputMediaPhotoArray ) Pop () (v InputMediaPhoto , 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 InputMediaGeoPointArray []InputMediaGeoPoint
func (s InputMediaGeoPointArray ) Sort (less func (a , b InputMediaGeoPoint ) bool ) InputMediaGeoPointArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s InputMediaGeoPointArray ) SortStable (less func (a , b InputMediaGeoPoint ) bool ) InputMediaGeoPointArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s InputMediaGeoPointArray ) Retain (keep func (x InputMediaGeoPoint ) bool ) InputMediaGeoPointArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s InputMediaGeoPointArray ) First () (v InputMediaGeoPoint , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s InputMediaGeoPointArray ) Last () (v InputMediaGeoPoint , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *InputMediaGeoPointArray ) PopFirst () (v InputMediaGeoPoint , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero InputMediaGeoPoint
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *InputMediaGeoPointArray ) Pop () (v InputMediaGeoPoint , 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 InputMediaContactArray []InputMediaContact
func (s InputMediaContactArray ) Sort (less func (a , b InputMediaContact ) bool ) InputMediaContactArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s InputMediaContactArray ) SortStable (less func (a , b InputMediaContact ) bool ) InputMediaContactArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s InputMediaContactArray ) Retain (keep func (x InputMediaContact ) bool ) InputMediaContactArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s InputMediaContactArray ) First () (v InputMediaContact , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s InputMediaContactArray ) Last () (v InputMediaContact , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *InputMediaContactArray ) PopFirst () (v InputMediaContact , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero InputMediaContact
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *InputMediaContactArray ) Pop () (v InputMediaContact , 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 InputMediaUploadedDocumentArray []InputMediaUploadedDocument
func (s InputMediaUploadedDocumentArray ) Sort (less func (a , b InputMediaUploadedDocument ) bool ) InputMediaUploadedDocumentArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s InputMediaUploadedDocumentArray ) SortStable (less func (a , b InputMediaUploadedDocument ) bool ) InputMediaUploadedDocumentArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s InputMediaUploadedDocumentArray ) Retain (keep func (x InputMediaUploadedDocument ) bool ) InputMediaUploadedDocumentArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s InputMediaUploadedDocumentArray ) First () (v InputMediaUploadedDocument , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s InputMediaUploadedDocumentArray ) Last () (v InputMediaUploadedDocument , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *InputMediaUploadedDocumentArray ) PopFirst () (v InputMediaUploadedDocument , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero InputMediaUploadedDocument
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *InputMediaUploadedDocumentArray ) Pop () (v InputMediaUploadedDocument , 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 InputMediaDocumentArray []InputMediaDocument
func (s InputMediaDocumentArray ) Sort (less func (a , b InputMediaDocument ) bool ) InputMediaDocumentArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s InputMediaDocumentArray ) SortStable (less func (a , b InputMediaDocument ) bool ) InputMediaDocumentArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s InputMediaDocumentArray ) Retain (keep func (x InputMediaDocument ) bool ) InputMediaDocumentArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s InputMediaDocumentArray ) First () (v InputMediaDocument , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s InputMediaDocumentArray ) Last () (v InputMediaDocument , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *InputMediaDocumentArray ) PopFirst () (v InputMediaDocument , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero InputMediaDocument
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *InputMediaDocumentArray ) Pop () (v InputMediaDocument , 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 InputMediaVenueArray []InputMediaVenue
func (s InputMediaVenueArray ) Sort (less func (a , b InputMediaVenue ) bool ) InputMediaVenueArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s InputMediaVenueArray ) SortStable (less func (a , b InputMediaVenue ) bool ) InputMediaVenueArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s InputMediaVenueArray ) Retain (keep func (x InputMediaVenue ) bool ) InputMediaVenueArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s InputMediaVenueArray ) First () (v InputMediaVenue , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s InputMediaVenueArray ) Last () (v InputMediaVenue , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *InputMediaVenueArray ) PopFirst () (v InputMediaVenue , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero InputMediaVenue
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *InputMediaVenueArray ) Pop () (v InputMediaVenue , 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 InputMediaPhotoExternalArray []InputMediaPhotoExternal
func (s InputMediaPhotoExternalArray ) Sort (less func (a , b InputMediaPhotoExternal ) bool ) InputMediaPhotoExternalArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s InputMediaPhotoExternalArray ) SortStable (less func (a , b InputMediaPhotoExternal ) bool ) InputMediaPhotoExternalArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s InputMediaPhotoExternalArray ) Retain (keep func (x InputMediaPhotoExternal ) bool ) InputMediaPhotoExternalArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s InputMediaPhotoExternalArray ) First () (v InputMediaPhotoExternal , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s InputMediaPhotoExternalArray ) Last () (v InputMediaPhotoExternal , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *InputMediaPhotoExternalArray ) PopFirst () (v InputMediaPhotoExternal , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero InputMediaPhotoExternal
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *InputMediaPhotoExternalArray ) Pop () (v InputMediaPhotoExternal , 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 InputMediaDocumentExternalArray []InputMediaDocumentExternal
func (s InputMediaDocumentExternalArray ) Sort (less func (a , b InputMediaDocumentExternal ) bool ) InputMediaDocumentExternalArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s InputMediaDocumentExternalArray ) SortStable (less func (a , b InputMediaDocumentExternal ) bool ) InputMediaDocumentExternalArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s InputMediaDocumentExternalArray ) Retain (keep func (x InputMediaDocumentExternal ) bool ) InputMediaDocumentExternalArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s InputMediaDocumentExternalArray ) First () (v InputMediaDocumentExternal , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s InputMediaDocumentExternalArray ) Last () (v InputMediaDocumentExternal , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *InputMediaDocumentExternalArray ) PopFirst () (v InputMediaDocumentExternal , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero InputMediaDocumentExternal
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *InputMediaDocumentExternalArray ) Pop () (v InputMediaDocumentExternal , 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 InputMediaGameArray []InputMediaGame
func (s InputMediaGameArray ) Sort (less func (a , b InputMediaGame ) bool ) InputMediaGameArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s InputMediaGameArray ) SortStable (less func (a , b InputMediaGame ) bool ) InputMediaGameArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s InputMediaGameArray ) Retain (keep func (x InputMediaGame ) bool ) InputMediaGameArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s InputMediaGameArray ) First () (v InputMediaGame , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s InputMediaGameArray ) Last () (v InputMediaGame , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *InputMediaGameArray ) PopFirst () (v InputMediaGame , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero InputMediaGame
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *InputMediaGameArray ) Pop () (v InputMediaGame , 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 InputMediaInvoiceArray []InputMediaInvoice
func (s InputMediaInvoiceArray ) Sort (less func (a , b InputMediaInvoice ) bool ) InputMediaInvoiceArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s InputMediaInvoiceArray ) SortStable (less func (a , b InputMediaInvoice ) bool ) InputMediaInvoiceArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s InputMediaInvoiceArray ) Retain (keep func (x InputMediaInvoice ) bool ) InputMediaInvoiceArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s InputMediaInvoiceArray ) First () (v InputMediaInvoice , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s InputMediaInvoiceArray ) Last () (v InputMediaInvoice , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *InputMediaInvoiceArray ) PopFirst () (v InputMediaInvoice , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero InputMediaInvoice
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *InputMediaInvoiceArray ) Pop () (v InputMediaInvoice , 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 InputMediaGeoLiveArray []InputMediaGeoLive
func (s InputMediaGeoLiveArray ) Sort (less func (a , b InputMediaGeoLive ) bool ) InputMediaGeoLiveArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s InputMediaGeoLiveArray ) SortStable (less func (a , b InputMediaGeoLive ) bool ) InputMediaGeoLiveArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s InputMediaGeoLiveArray ) Retain (keep func (x InputMediaGeoLive ) bool ) InputMediaGeoLiveArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s InputMediaGeoLiveArray ) First () (v InputMediaGeoLive , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s InputMediaGeoLiveArray ) Last () (v InputMediaGeoLive , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *InputMediaGeoLiveArray ) PopFirst () (v InputMediaGeoLive , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero InputMediaGeoLive
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *InputMediaGeoLiveArray ) Pop () (v InputMediaGeoLive , 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 InputMediaPollArray []InputMediaPoll
func (s InputMediaPollArray ) Sort (less func (a , b InputMediaPoll ) bool ) InputMediaPollArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s InputMediaPollArray ) SortStable (less func (a , b InputMediaPoll ) bool ) InputMediaPollArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s InputMediaPollArray ) Retain (keep func (x InputMediaPoll ) bool ) InputMediaPollArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s InputMediaPollArray ) First () (v InputMediaPoll , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s InputMediaPollArray ) Last () (v InputMediaPoll , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *InputMediaPollArray ) PopFirst () (v InputMediaPoll , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero InputMediaPoll
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *InputMediaPollArray ) Pop () (v InputMediaPoll , 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 InputMediaDiceArray []InputMediaDice
func (s InputMediaDiceArray ) Sort (less func (a , b InputMediaDice ) bool ) InputMediaDiceArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s InputMediaDiceArray ) SortStable (less func (a , b InputMediaDice ) bool ) InputMediaDiceArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s InputMediaDiceArray ) Retain (keep func (x InputMediaDice ) bool ) InputMediaDiceArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s InputMediaDiceArray ) First () (v InputMediaDice , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s InputMediaDiceArray ) Last () (v InputMediaDice , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *InputMediaDiceArray ) PopFirst () (v InputMediaDice , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero InputMediaDice
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *InputMediaDiceArray ) Pop () (v InputMediaDice , 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 InputMediaStoryArray []InputMediaStory
func (s InputMediaStoryArray ) Sort (less func (a , b InputMediaStory ) bool ) InputMediaStoryArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s InputMediaStoryArray ) SortStable (less func (a , b InputMediaStory ) bool ) InputMediaStoryArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s InputMediaStoryArray ) Retain (keep func (x InputMediaStory ) bool ) InputMediaStoryArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s InputMediaStoryArray ) First () (v InputMediaStory , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s InputMediaStoryArray ) Last () (v InputMediaStory , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *InputMediaStoryArray ) PopFirst () (v InputMediaStory , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero InputMediaStory
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *InputMediaStoryArray ) Pop () (v InputMediaStory , 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 InputMediaStoryArray ) SortByID () InputMediaStoryArray {
return s .Sort (func (a , b InputMediaStory ) bool {
return a .GetID () < b .GetID ()
})
}
func (s InputMediaStoryArray ) SortStableByID () InputMediaStoryArray {
return s .SortStable (func (a , b InputMediaStory ) bool {
return a .GetID () < b .GetID ()
})
}
func (s InputMediaStoryArray ) FillMap (to map [int ]InputMediaStory ) {
for _ , value := range s {
to [value .GetID ()] = value
}
}
func (s InputMediaStoryArray ) ToMap () map [int ]InputMediaStory {
r := make (map [int ]InputMediaStory , len (s ))
s .FillMap (r )
return r
}
type InputMediaWebPageArray []InputMediaWebPage
func (s InputMediaWebPageArray ) Sort (less func (a , b InputMediaWebPage ) bool ) InputMediaWebPageArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s InputMediaWebPageArray ) SortStable (less func (a , b InputMediaWebPage ) bool ) InputMediaWebPageArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s InputMediaWebPageArray ) Retain (keep func (x InputMediaWebPage ) bool ) InputMediaWebPageArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s InputMediaWebPageArray ) First () (v InputMediaWebPage , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s InputMediaWebPageArray ) Last () (v InputMediaWebPage , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *InputMediaWebPageArray ) PopFirst () (v InputMediaWebPage , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero InputMediaWebPage
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *InputMediaWebPageArray ) Pop () (v InputMediaWebPage , 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 .