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 EncryptedChatClassArray []EncryptedChatClass
func (s EncryptedChatClassArray ) Sort (less func (a , b EncryptedChatClass ) bool ) EncryptedChatClassArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s EncryptedChatClassArray ) SortStable (less func (a , b EncryptedChatClass ) bool ) EncryptedChatClassArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s EncryptedChatClassArray ) Retain (keep func (x EncryptedChatClass ) bool ) EncryptedChatClassArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s EncryptedChatClassArray ) First () (v EncryptedChatClass , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s EncryptedChatClassArray ) Last () (v EncryptedChatClass , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *EncryptedChatClassArray ) PopFirst () (v EncryptedChatClass , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero EncryptedChatClass
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *EncryptedChatClassArray ) Pop () (v EncryptedChatClass , 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 EncryptedChatClassArray ) SortByID () EncryptedChatClassArray {
return s .Sort (func (a , b EncryptedChatClass ) bool {
return a .GetID () < b .GetID ()
})
}
func (s EncryptedChatClassArray ) SortStableByID () EncryptedChatClassArray {
return s .SortStable (func (a , b EncryptedChatClass ) bool {
return a .GetID () < b .GetID ()
})
}
func (s EncryptedChatClassArray ) FillEncryptedChatEmptyMap (to map [int ]*EncryptedChatEmpty ) {
for _ , elem := range s {
value , ok := elem .(*EncryptedChatEmpty )
if !ok {
continue
}
to [value .GetID ()] = value
}
}
func (s EncryptedChatClassArray ) EncryptedChatEmptyToMap () map [int ]*EncryptedChatEmpty {
r := make (map [int ]*EncryptedChatEmpty , len (s ))
s .FillEncryptedChatEmptyMap (r )
return r
}
func (s EncryptedChatClassArray ) AsEncryptedChatEmpty () (to EncryptedChatEmptyArray ) {
for _ , elem := range s {
value , ok := elem .(*EncryptedChatEmpty )
if !ok {
continue
}
to = append (to , *value )
}
return to
}
func (s EncryptedChatClassArray ) FillEncryptedChatWaitingMap (to map [int ]*EncryptedChatWaiting ) {
for _ , elem := range s {
value , ok := elem .(*EncryptedChatWaiting )
if !ok {
continue
}
to [value .GetID ()] = value
}
}
func (s EncryptedChatClassArray ) EncryptedChatWaitingToMap () map [int ]*EncryptedChatWaiting {
r := make (map [int ]*EncryptedChatWaiting , len (s ))
s .FillEncryptedChatWaitingMap (r )
return r
}
func (s EncryptedChatClassArray ) AsEncryptedChatWaiting () (to EncryptedChatWaitingArray ) {
for _ , elem := range s {
value , ok := elem .(*EncryptedChatWaiting )
if !ok {
continue
}
to = append (to , *value )
}
return to
}
func (s EncryptedChatClassArray ) FillEncryptedChatRequestedMap (to map [int ]*EncryptedChatRequested ) {
for _ , elem := range s {
value , ok := elem .(*EncryptedChatRequested )
if !ok {
continue
}
to [value .GetID ()] = value
}
}
func (s EncryptedChatClassArray ) EncryptedChatRequestedToMap () map [int ]*EncryptedChatRequested {
r := make (map [int ]*EncryptedChatRequested , len (s ))
s .FillEncryptedChatRequestedMap (r )
return r
}
func (s EncryptedChatClassArray ) AsEncryptedChatRequested () (to EncryptedChatRequestedArray ) {
for _ , elem := range s {
value , ok := elem .(*EncryptedChatRequested )
if !ok {
continue
}
to = append (to , *value )
}
return to
}
func (s EncryptedChatClassArray ) FillEncryptedChatMap (to map [int ]*EncryptedChat ) {
for _ , elem := range s {
value , ok := elem .(*EncryptedChat )
if !ok {
continue
}
to [value .GetID ()] = value
}
}
func (s EncryptedChatClassArray ) EncryptedChatToMap () map [int ]*EncryptedChat {
r := make (map [int ]*EncryptedChat , len (s ))
s .FillEncryptedChatMap (r )
return r
}
func (s EncryptedChatClassArray ) AsEncryptedChat () (to EncryptedChatArray ) {
for _ , elem := range s {
value , ok := elem .(*EncryptedChat )
if !ok {
continue
}
to = append (to , *value )
}
return to
}
func (s EncryptedChatClassArray ) FillEncryptedChatDiscardedMap (to map [int ]*EncryptedChatDiscarded ) {
for _ , elem := range s {
value , ok := elem .(*EncryptedChatDiscarded )
if !ok {
continue
}
to [value .GetID ()] = value
}
}
func (s EncryptedChatClassArray ) EncryptedChatDiscardedToMap () map [int ]*EncryptedChatDiscarded {
r := make (map [int ]*EncryptedChatDiscarded , len (s ))
s .FillEncryptedChatDiscardedMap (r )
return r
}
func (s EncryptedChatClassArray ) AsEncryptedChatDiscarded () (to EncryptedChatDiscardedArray ) {
for _ , elem := range s {
value , ok := elem .(*EncryptedChatDiscarded )
if !ok {
continue
}
to = append (to , *value )
}
return to
}
func (s EncryptedChatClassArray ) FillNotEmptyMap (to map [int ]NotEmptyEncryptedChat ) {
for _ , elem := range s {
value , ok := elem .AsNotEmpty ()
if !ok {
continue
}
to [value .GetID ()] = value
}
}
func (s EncryptedChatClassArray ) NotEmptyToMap () map [int ]NotEmptyEncryptedChat {
r := make (map [int ]NotEmptyEncryptedChat , len (s ))
s .FillNotEmptyMap (r )
return r
}
func (s EncryptedChatClassArray ) AppendOnlyNotEmpty (to []NotEmptyEncryptedChat ) []NotEmptyEncryptedChat {
for _ , elem := range s {
value , ok := elem .AsNotEmpty ()
if !ok {
continue
}
to = append (to , value )
}
return to
}
func (s EncryptedChatClassArray ) AsNotEmpty () (to []NotEmptyEncryptedChat ) {
return s .AppendOnlyNotEmpty (to )
}
func (s EncryptedChatClassArray ) FirstAsNotEmpty () (v NotEmptyEncryptedChat , ok bool ) {
value , ok := s .First ()
if !ok {
return
}
return value .AsNotEmpty ()
}
func (s EncryptedChatClassArray ) LastAsNotEmpty () (v NotEmptyEncryptedChat , ok bool ) {
value , ok := s .Last ()
if !ok {
return
}
return value .AsNotEmpty ()
}
func (s *EncryptedChatClassArray ) PopFirstAsNotEmpty () (v NotEmptyEncryptedChat , ok bool ) {
value , ok := s .PopFirst ()
if !ok {
return
}
return value .AsNotEmpty ()
}
func (s *EncryptedChatClassArray ) PopAsNotEmpty () (v NotEmptyEncryptedChat , ok bool ) {
value , ok := s .Pop ()
if !ok {
return
}
return value .AsNotEmpty ()
}
type EncryptedChatEmptyArray []EncryptedChatEmpty
func (s EncryptedChatEmptyArray ) Sort (less func (a , b EncryptedChatEmpty ) bool ) EncryptedChatEmptyArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s EncryptedChatEmptyArray ) SortStable (less func (a , b EncryptedChatEmpty ) bool ) EncryptedChatEmptyArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s EncryptedChatEmptyArray ) Retain (keep func (x EncryptedChatEmpty ) bool ) EncryptedChatEmptyArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s EncryptedChatEmptyArray ) First () (v EncryptedChatEmpty , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s EncryptedChatEmptyArray ) Last () (v EncryptedChatEmpty , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *EncryptedChatEmptyArray ) PopFirst () (v EncryptedChatEmpty , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero EncryptedChatEmpty
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *EncryptedChatEmptyArray ) Pop () (v EncryptedChatEmpty , 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 EncryptedChatEmptyArray ) SortByID () EncryptedChatEmptyArray {
return s .Sort (func (a , b EncryptedChatEmpty ) bool {
return a .GetID () < b .GetID ()
})
}
func (s EncryptedChatEmptyArray ) SortStableByID () EncryptedChatEmptyArray {
return s .SortStable (func (a , b EncryptedChatEmpty ) bool {
return a .GetID () < b .GetID ()
})
}
func (s EncryptedChatEmptyArray ) FillMap (to map [int ]EncryptedChatEmpty ) {
for _ , value := range s {
to [value .GetID ()] = value
}
}
func (s EncryptedChatEmptyArray ) ToMap () map [int ]EncryptedChatEmpty {
r := make (map [int ]EncryptedChatEmpty , len (s ))
s .FillMap (r )
return r
}
type EncryptedChatWaitingArray []EncryptedChatWaiting
func (s EncryptedChatWaitingArray ) Sort (less func (a , b EncryptedChatWaiting ) bool ) EncryptedChatWaitingArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s EncryptedChatWaitingArray ) SortStable (less func (a , b EncryptedChatWaiting ) bool ) EncryptedChatWaitingArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s EncryptedChatWaitingArray ) Retain (keep func (x EncryptedChatWaiting ) bool ) EncryptedChatWaitingArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s EncryptedChatWaitingArray ) First () (v EncryptedChatWaiting , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s EncryptedChatWaitingArray ) Last () (v EncryptedChatWaiting , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *EncryptedChatWaitingArray ) PopFirst () (v EncryptedChatWaiting , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero EncryptedChatWaiting
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *EncryptedChatWaitingArray ) Pop () (v EncryptedChatWaiting , 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 EncryptedChatWaitingArray ) SortByID () EncryptedChatWaitingArray {
return s .Sort (func (a , b EncryptedChatWaiting ) bool {
return a .GetID () < b .GetID ()
})
}
func (s EncryptedChatWaitingArray ) SortStableByID () EncryptedChatWaitingArray {
return s .SortStable (func (a , b EncryptedChatWaiting ) bool {
return a .GetID () < b .GetID ()
})
}
func (s EncryptedChatWaitingArray ) SortByDate () EncryptedChatWaitingArray {
return s .Sort (func (a , b EncryptedChatWaiting ) bool {
return a .GetDate () < b .GetDate ()
})
}
func (s EncryptedChatWaitingArray ) SortStableByDate () EncryptedChatWaitingArray {
return s .SortStable (func (a , b EncryptedChatWaiting ) bool {
return a .GetDate () < b .GetDate ()
})
}
func (s EncryptedChatWaitingArray ) FillMap (to map [int ]EncryptedChatWaiting ) {
for _ , value := range s {
to [value .GetID ()] = value
}
}
func (s EncryptedChatWaitingArray ) ToMap () map [int ]EncryptedChatWaiting {
r := make (map [int ]EncryptedChatWaiting , len (s ))
s .FillMap (r )
return r
}
type EncryptedChatRequestedArray []EncryptedChatRequested
func (s EncryptedChatRequestedArray ) Sort (less func (a , b EncryptedChatRequested ) bool ) EncryptedChatRequestedArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s EncryptedChatRequestedArray ) SortStable (less func (a , b EncryptedChatRequested ) bool ) EncryptedChatRequestedArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s EncryptedChatRequestedArray ) Retain (keep func (x EncryptedChatRequested ) bool ) EncryptedChatRequestedArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s EncryptedChatRequestedArray ) First () (v EncryptedChatRequested , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s EncryptedChatRequestedArray ) Last () (v EncryptedChatRequested , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *EncryptedChatRequestedArray ) PopFirst () (v EncryptedChatRequested , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero EncryptedChatRequested
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *EncryptedChatRequestedArray ) Pop () (v EncryptedChatRequested , 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 EncryptedChatRequestedArray ) SortByID () EncryptedChatRequestedArray {
return s .Sort (func (a , b EncryptedChatRequested ) bool {
return a .GetID () < b .GetID ()
})
}
func (s EncryptedChatRequestedArray ) SortStableByID () EncryptedChatRequestedArray {
return s .SortStable (func (a , b EncryptedChatRequested ) bool {
return a .GetID () < b .GetID ()
})
}
func (s EncryptedChatRequestedArray ) SortByDate () EncryptedChatRequestedArray {
return s .Sort (func (a , b EncryptedChatRequested ) bool {
return a .GetDate () < b .GetDate ()
})
}
func (s EncryptedChatRequestedArray ) SortStableByDate () EncryptedChatRequestedArray {
return s .SortStable (func (a , b EncryptedChatRequested ) bool {
return a .GetDate () < b .GetDate ()
})
}
func (s EncryptedChatRequestedArray ) FillMap (to map [int ]EncryptedChatRequested ) {
for _ , value := range s {
to [value .GetID ()] = value
}
}
func (s EncryptedChatRequestedArray ) ToMap () map [int ]EncryptedChatRequested {
r := make (map [int ]EncryptedChatRequested , len (s ))
s .FillMap (r )
return r
}
type EncryptedChatArray []EncryptedChat
func (s EncryptedChatArray ) Sort (less func (a , b EncryptedChat ) bool ) EncryptedChatArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s EncryptedChatArray ) SortStable (less func (a , b EncryptedChat ) bool ) EncryptedChatArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s EncryptedChatArray ) Retain (keep func (x EncryptedChat ) bool ) EncryptedChatArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s EncryptedChatArray ) First () (v EncryptedChat , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s EncryptedChatArray ) Last () (v EncryptedChat , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *EncryptedChatArray ) PopFirst () (v EncryptedChat , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero EncryptedChat
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *EncryptedChatArray ) Pop () (v EncryptedChat , 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 EncryptedChatArray ) SortByID () EncryptedChatArray {
return s .Sort (func (a , b EncryptedChat ) bool {
return a .GetID () < b .GetID ()
})
}
func (s EncryptedChatArray ) SortStableByID () EncryptedChatArray {
return s .SortStable (func (a , b EncryptedChat ) bool {
return a .GetID () < b .GetID ()
})
}
func (s EncryptedChatArray ) SortByDate () EncryptedChatArray {
return s .Sort (func (a , b EncryptedChat ) bool {
return a .GetDate () < b .GetDate ()
})
}
func (s EncryptedChatArray ) SortStableByDate () EncryptedChatArray {
return s .SortStable (func (a , b EncryptedChat ) bool {
return a .GetDate () < b .GetDate ()
})
}
func (s EncryptedChatArray ) FillMap (to map [int ]EncryptedChat ) {
for _ , value := range s {
to [value .GetID ()] = value
}
}
func (s EncryptedChatArray ) ToMap () map [int ]EncryptedChat {
r := make (map [int ]EncryptedChat , len (s ))
s .FillMap (r )
return r
}
type EncryptedChatDiscardedArray []EncryptedChatDiscarded
func (s EncryptedChatDiscardedArray ) Sort (less func (a , b EncryptedChatDiscarded ) bool ) EncryptedChatDiscardedArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s EncryptedChatDiscardedArray ) SortStable (less func (a , b EncryptedChatDiscarded ) bool ) EncryptedChatDiscardedArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s EncryptedChatDiscardedArray ) Retain (keep func (x EncryptedChatDiscarded ) bool ) EncryptedChatDiscardedArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s EncryptedChatDiscardedArray ) First () (v EncryptedChatDiscarded , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s EncryptedChatDiscardedArray ) Last () (v EncryptedChatDiscarded , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *EncryptedChatDiscardedArray ) PopFirst () (v EncryptedChatDiscarded , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero EncryptedChatDiscarded
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *EncryptedChatDiscardedArray ) Pop () (v EncryptedChatDiscarded , 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 EncryptedChatDiscardedArray ) SortByID () EncryptedChatDiscardedArray {
return s .Sort (func (a , b EncryptedChatDiscarded ) bool {
return a .GetID () < b .GetID ()
})
}
func (s EncryptedChatDiscardedArray ) SortStableByID () EncryptedChatDiscardedArray {
return s .SortStable (func (a , b EncryptedChatDiscarded ) bool {
return a .GetID () < b .GetID ()
})
}
func (s EncryptedChatDiscardedArray ) FillMap (to map [int ]EncryptedChatDiscarded ) {
for _ , value := range s {
to [value .GetID ()] = value
}
}
func (s EncryptedChatDiscardedArray ) ToMap () map [int ]EncryptedChatDiscarded {
r := make (map [int ]EncryptedChatDiscarded , len (s ))
s .FillMap (r )
return r
}
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 .