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 MessagesSentEncryptedMessageClassArray []MessagesSentEncryptedMessageClass
func (s MessagesSentEncryptedMessageClassArray ) Sort (less func (a , b MessagesSentEncryptedMessageClass ) bool ) MessagesSentEncryptedMessageClassArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s MessagesSentEncryptedMessageClassArray ) SortStable (less func (a , b MessagesSentEncryptedMessageClass ) bool ) MessagesSentEncryptedMessageClassArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s MessagesSentEncryptedMessageClassArray ) Retain (keep func (x MessagesSentEncryptedMessageClass ) bool ) MessagesSentEncryptedMessageClassArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s MessagesSentEncryptedMessageClassArray ) First () (v MessagesSentEncryptedMessageClass , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s MessagesSentEncryptedMessageClassArray ) Last () (v MessagesSentEncryptedMessageClass , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *MessagesSentEncryptedMessageClassArray ) PopFirst () (v MessagesSentEncryptedMessageClass , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero MessagesSentEncryptedMessageClass
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *MessagesSentEncryptedMessageClassArray ) Pop () (v MessagesSentEncryptedMessageClass , 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 MessagesSentEncryptedMessageClassArray ) SortByDate () MessagesSentEncryptedMessageClassArray {
return s .Sort (func (a , b MessagesSentEncryptedMessageClass ) bool {
return a .GetDate () < b .GetDate ()
})
}
func (s MessagesSentEncryptedMessageClassArray ) SortStableByDate () MessagesSentEncryptedMessageClassArray {
return s .SortStable (func (a , b MessagesSentEncryptedMessageClass ) bool {
return a .GetDate () < b .GetDate ()
})
}
func (s MessagesSentEncryptedMessageClassArray ) AsMessagesSentEncryptedMessage () (to MessagesSentEncryptedMessageArray ) {
for _ , elem := range s {
value , ok := elem .(*MessagesSentEncryptedMessage )
if !ok {
continue
}
to = append (to , *value )
}
return to
}
func (s MessagesSentEncryptedMessageClassArray ) AsMessagesSentEncryptedFile () (to MessagesSentEncryptedFileArray ) {
for _ , elem := range s {
value , ok := elem .(*MessagesSentEncryptedFile )
if !ok {
continue
}
to = append (to , *value )
}
return to
}
type MessagesSentEncryptedMessageArray []MessagesSentEncryptedMessage
func (s MessagesSentEncryptedMessageArray ) Sort (less func (a , b MessagesSentEncryptedMessage ) bool ) MessagesSentEncryptedMessageArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s MessagesSentEncryptedMessageArray ) SortStable (less func (a , b MessagesSentEncryptedMessage ) bool ) MessagesSentEncryptedMessageArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s MessagesSentEncryptedMessageArray ) Retain (keep func (x MessagesSentEncryptedMessage ) bool ) MessagesSentEncryptedMessageArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s MessagesSentEncryptedMessageArray ) First () (v MessagesSentEncryptedMessage , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s MessagesSentEncryptedMessageArray ) Last () (v MessagesSentEncryptedMessage , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *MessagesSentEncryptedMessageArray ) PopFirst () (v MessagesSentEncryptedMessage , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero MessagesSentEncryptedMessage
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *MessagesSentEncryptedMessageArray ) Pop () (v MessagesSentEncryptedMessage , 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 MessagesSentEncryptedMessageArray ) SortByDate () MessagesSentEncryptedMessageArray {
return s .Sort (func (a , b MessagesSentEncryptedMessage ) bool {
return a .GetDate () < b .GetDate ()
})
}
func (s MessagesSentEncryptedMessageArray ) SortStableByDate () MessagesSentEncryptedMessageArray {
return s .SortStable (func (a , b MessagesSentEncryptedMessage ) bool {
return a .GetDate () < b .GetDate ()
})
}
type MessagesSentEncryptedFileArray []MessagesSentEncryptedFile
func (s MessagesSentEncryptedFileArray ) Sort (less func (a , b MessagesSentEncryptedFile ) bool ) MessagesSentEncryptedFileArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s MessagesSentEncryptedFileArray ) SortStable (less func (a , b MessagesSentEncryptedFile ) bool ) MessagesSentEncryptedFileArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s MessagesSentEncryptedFileArray ) Retain (keep func (x MessagesSentEncryptedFile ) bool ) MessagesSentEncryptedFileArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s MessagesSentEncryptedFileArray ) First () (v MessagesSentEncryptedFile , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s MessagesSentEncryptedFileArray ) Last () (v MessagesSentEncryptedFile , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *MessagesSentEncryptedFileArray ) PopFirst () (v MessagesSentEncryptedFile , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero MessagesSentEncryptedFile
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *MessagesSentEncryptedFileArray ) Pop () (v MessagesSentEncryptedFile , 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 MessagesSentEncryptedFileArray ) SortByDate () MessagesSentEncryptedFileArray {
return s .Sort (func (a , b MessagesSentEncryptedFile ) bool {
return a .GetDate () < b .GetDate ()
})
}
func (s MessagesSentEncryptedFileArray ) SortStableByDate () MessagesSentEncryptedFileArray {
return s .SortStable (func (a , b MessagesSentEncryptedFile ) bool {
return a .GetDate () < b .GetDate ()
})
}
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 .