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 ChatClassArray []ChatClass
func (s ChatClassArray ) Sort (less func (a , b ChatClass ) bool ) ChatClassArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s ChatClassArray ) SortStable (less func (a , b ChatClass ) bool ) ChatClassArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s ChatClassArray ) Retain (keep func (x ChatClass ) bool ) ChatClassArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s ChatClassArray ) First () (v ChatClass , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s ChatClassArray ) Last () (v ChatClass , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *ChatClassArray ) PopFirst () (v ChatClass , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero ChatClass
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *ChatClassArray ) Pop () (v ChatClass , 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 ChatClassArray ) SortByID () ChatClassArray {
return s .Sort (func (a , b ChatClass ) bool {
return a .GetID () < b .GetID ()
})
}
func (s ChatClassArray ) SortStableByID () ChatClassArray {
return s .SortStable (func (a , b ChatClass ) bool {
return a .GetID () < b .GetID ()
})
}
func (s ChatClassArray ) FillChatEmptyMap (to map [int64 ]*ChatEmpty ) {
for _ , elem := range s {
value , ok := elem .(*ChatEmpty )
if !ok {
continue
}
to [value .GetID ()] = value
}
}
func (s ChatClassArray ) ChatEmptyToMap () map [int64 ]*ChatEmpty {
r := make (map [int64 ]*ChatEmpty , len (s ))
s .FillChatEmptyMap (r )
return r
}
func (s ChatClassArray ) AsChatEmpty () (to ChatEmptyArray ) {
for _ , elem := range s {
value , ok := elem .(*ChatEmpty )
if !ok {
continue
}
to = append (to , *value )
}
return to
}
func (s ChatClassArray ) FillChatMap (to map [int64 ]*Chat ) {
for _ , elem := range s {
value , ok := elem .(*Chat )
if !ok {
continue
}
to [value .GetID ()] = value
}
}
func (s ChatClassArray ) ChatToMap () map [int64 ]*Chat {
r := make (map [int64 ]*Chat , len (s ))
s .FillChatMap (r )
return r
}
func (s ChatClassArray ) AsChat () (to ChatArray ) {
for _ , elem := range s {
value , ok := elem .(*Chat )
if !ok {
continue
}
to = append (to , *value )
}
return to
}
func (s ChatClassArray ) FillChatForbiddenMap (to map [int64 ]*ChatForbidden ) {
for _ , elem := range s {
value , ok := elem .(*ChatForbidden )
if !ok {
continue
}
to [value .GetID ()] = value
}
}
func (s ChatClassArray ) ChatForbiddenToMap () map [int64 ]*ChatForbidden {
r := make (map [int64 ]*ChatForbidden , len (s ))
s .FillChatForbiddenMap (r )
return r
}
func (s ChatClassArray ) AsChatForbidden () (to ChatForbiddenArray ) {
for _ , elem := range s {
value , ok := elem .(*ChatForbidden )
if !ok {
continue
}
to = append (to , *value )
}
return to
}
func (s ChatClassArray ) FillChannelMap (to map [int64 ]*Channel ) {
for _ , elem := range s {
value , ok := elem .(*Channel )
if !ok {
continue
}
to [value .GetID ()] = value
}
}
func (s ChatClassArray ) ChannelToMap () map [int64 ]*Channel {
r := make (map [int64 ]*Channel , len (s ))
s .FillChannelMap (r )
return r
}
func (s ChatClassArray ) AsChannel () (to ChannelArray ) {
for _ , elem := range s {
value , ok := elem .(*Channel )
if !ok {
continue
}
to = append (to , *value )
}
return to
}
func (s ChatClassArray ) FillChannelForbiddenMap (to map [int64 ]*ChannelForbidden ) {
for _ , elem := range s {
value , ok := elem .(*ChannelForbidden )
if !ok {
continue
}
to [value .GetID ()] = value
}
}
func (s ChatClassArray ) ChannelForbiddenToMap () map [int64 ]*ChannelForbidden {
r := make (map [int64 ]*ChannelForbidden , len (s ))
s .FillChannelForbiddenMap (r )
return r
}
func (s ChatClassArray ) AsChannelForbidden () (to ChannelForbiddenArray ) {
for _ , elem := range s {
value , ok := elem .(*ChannelForbidden )
if !ok {
continue
}
to = append (to , *value )
}
return to
}
func (s ChatClassArray ) FillNotEmptyMap (to map [int64 ]NotEmptyChat ) {
for _ , elem := range s {
value , ok := elem .AsNotEmpty ()
if !ok {
continue
}
to [value .GetID ()] = value
}
}
func (s ChatClassArray ) NotEmptyToMap () map [int64 ]NotEmptyChat {
r := make (map [int64 ]NotEmptyChat , len (s ))
s .FillNotEmptyMap (r )
return r
}
func (s ChatClassArray ) AppendOnlyNotEmpty (to []NotEmptyChat ) []NotEmptyChat {
for _ , elem := range s {
value , ok := elem .AsNotEmpty ()
if !ok {
continue
}
to = append (to , value )
}
return to
}
func (s ChatClassArray ) AsNotEmpty () (to []NotEmptyChat ) {
return s .AppendOnlyNotEmpty (to )
}
func (s ChatClassArray ) FirstAsNotEmpty () (v NotEmptyChat , ok bool ) {
value , ok := s .First ()
if !ok {
return
}
return value .AsNotEmpty ()
}
func (s ChatClassArray ) LastAsNotEmpty () (v NotEmptyChat , ok bool ) {
value , ok := s .Last ()
if !ok {
return
}
return value .AsNotEmpty ()
}
func (s *ChatClassArray ) PopFirstAsNotEmpty () (v NotEmptyChat , ok bool ) {
value , ok := s .PopFirst ()
if !ok {
return
}
return value .AsNotEmpty ()
}
func (s *ChatClassArray ) PopAsNotEmpty () (v NotEmptyChat , ok bool ) {
value , ok := s .Pop ()
if !ok {
return
}
return value .AsNotEmpty ()
}
func (s ChatClassArray ) FillNotForbiddenMap (to map [int64 ]NotForbiddenChat ) {
for _ , elem := range s {
value , ok := elem .AsNotForbidden ()
if !ok {
continue
}
to [value .GetID ()] = value
}
}
func (s ChatClassArray ) NotForbiddenToMap () map [int64 ]NotForbiddenChat {
r := make (map [int64 ]NotForbiddenChat , len (s ))
s .FillNotForbiddenMap (r )
return r
}
func (s ChatClassArray ) AppendOnlyNotForbidden (to []NotForbiddenChat ) []NotForbiddenChat {
for _ , elem := range s {
value , ok := elem .AsNotForbidden ()
if !ok {
continue
}
to = append (to , value )
}
return to
}
func (s ChatClassArray ) AsNotForbidden () (to []NotForbiddenChat ) {
return s .AppendOnlyNotForbidden (to )
}
func (s ChatClassArray ) FirstAsNotForbidden () (v NotForbiddenChat , ok bool ) {
value , ok := s .First ()
if !ok {
return
}
return value .AsNotForbidden ()
}
func (s ChatClassArray ) LastAsNotForbidden () (v NotForbiddenChat , ok bool ) {
value , ok := s .Last ()
if !ok {
return
}
return value .AsNotForbidden ()
}
func (s *ChatClassArray ) PopFirstAsNotForbidden () (v NotForbiddenChat , ok bool ) {
value , ok := s .PopFirst ()
if !ok {
return
}
return value .AsNotForbidden ()
}
func (s *ChatClassArray ) PopAsNotForbidden () (v NotForbiddenChat , ok bool ) {
value , ok := s .Pop ()
if !ok {
return
}
return value .AsNotForbidden ()
}
func (s ChatClassArray ) FillFullMap (to map [int64 ]FullChat ) {
for _ , elem := range s {
value , ok := elem .AsFull ()
if !ok {
continue
}
to [value .GetID ()] = value
}
}
func (s ChatClassArray ) FullToMap () map [int64 ]FullChat {
r := make (map [int64 ]FullChat , len (s ))
s .FillFullMap (r )
return r
}
func (s ChatClassArray ) AppendOnlyFull (to []FullChat ) []FullChat {
for _ , elem := range s {
value , ok := elem .AsFull ()
if !ok {
continue
}
to = append (to , value )
}
return to
}
func (s ChatClassArray ) AsFull () (to []FullChat ) {
return s .AppendOnlyFull (to )
}
func (s ChatClassArray ) FirstAsFull () (v FullChat , ok bool ) {
value , ok := s .First ()
if !ok {
return
}
return value .AsFull ()
}
func (s ChatClassArray ) LastAsFull () (v FullChat , ok bool ) {
value , ok := s .Last ()
if !ok {
return
}
return value .AsFull ()
}
func (s *ChatClassArray ) PopFirstAsFull () (v FullChat , ok bool ) {
value , ok := s .PopFirst ()
if !ok {
return
}
return value .AsFull ()
}
func (s *ChatClassArray ) PopAsFull () (v FullChat , ok bool ) {
value , ok := s .Pop ()
if !ok {
return
}
return value .AsFull ()
}
type ChatEmptyArray []ChatEmpty
func (s ChatEmptyArray ) Sort (less func (a , b ChatEmpty ) bool ) ChatEmptyArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s ChatEmptyArray ) SortStable (less func (a , b ChatEmpty ) bool ) ChatEmptyArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s ChatEmptyArray ) Retain (keep func (x ChatEmpty ) bool ) ChatEmptyArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s ChatEmptyArray ) First () (v ChatEmpty , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s ChatEmptyArray ) Last () (v ChatEmpty , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *ChatEmptyArray ) PopFirst () (v ChatEmpty , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero ChatEmpty
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *ChatEmptyArray ) Pop () (v ChatEmpty , 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 ChatEmptyArray ) SortByID () ChatEmptyArray {
return s .Sort (func (a , b ChatEmpty ) bool {
return a .GetID () < b .GetID ()
})
}
func (s ChatEmptyArray ) SortStableByID () ChatEmptyArray {
return s .SortStable (func (a , b ChatEmpty ) bool {
return a .GetID () < b .GetID ()
})
}
func (s ChatEmptyArray ) FillMap (to map [int64 ]ChatEmpty ) {
for _ , value := range s {
to [value .GetID ()] = value
}
}
func (s ChatEmptyArray ) ToMap () map [int64 ]ChatEmpty {
r := make (map [int64 ]ChatEmpty , len (s ))
s .FillMap (r )
return r
}
type ChatArray []Chat
func (s ChatArray ) Sort (less func (a , b Chat ) bool ) ChatArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s ChatArray ) SortStable (less func (a , b Chat ) bool ) ChatArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s ChatArray ) Retain (keep func (x Chat ) bool ) ChatArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s ChatArray ) First () (v Chat , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s ChatArray ) Last () (v Chat , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *ChatArray ) PopFirst () (v Chat , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero Chat
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *ChatArray ) Pop () (v Chat , 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 ChatArray ) SortByID () ChatArray {
return s .Sort (func (a , b Chat ) bool {
return a .GetID () < b .GetID ()
})
}
func (s ChatArray ) SortStableByID () ChatArray {
return s .SortStable (func (a , b Chat ) bool {
return a .GetID () < b .GetID ()
})
}
func (s ChatArray ) SortByDate () ChatArray {
return s .Sort (func (a , b Chat ) bool {
return a .GetDate () < b .GetDate ()
})
}
func (s ChatArray ) SortStableByDate () ChatArray {
return s .SortStable (func (a , b Chat ) bool {
return a .GetDate () < b .GetDate ()
})
}
func (s ChatArray ) FillMap (to map [int64 ]Chat ) {
for _ , value := range s {
to [value .GetID ()] = value
}
}
func (s ChatArray ) ToMap () map [int64 ]Chat {
r := make (map [int64 ]Chat , len (s ))
s .FillMap (r )
return r
}
type ChatForbiddenArray []ChatForbidden
func (s ChatForbiddenArray ) Sort (less func (a , b ChatForbidden ) bool ) ChatForbiddenArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s ChatForbiddenArray ) SortStable (less func (a , b ChatForbidden ) bool ) ChatForbiddenArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s ChatForbiddenArray ) Retain (keep func (x ChatForbidden ) bool ) ChatForbiddenArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s ChatForbiddenArray ) First () (v ChatForbidden , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s ChatForbiddenArray ) Last () (v ChatForbidden , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *ChatForbiddenArray ) PopFirst () (v ChatForbidden , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero ChatForbidden
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *ChatForbiddenArray ) Pop () (v ChatForbidden , 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 ChatForbiddenArray ) SortByID () ChatForbiddenArray {
return s .Sort (func (a , b ChatForbidden ) bool {
return a .GetID () < b .GetID ()
})
}
func (s ChatForbiddenArray ) SortStableByID () ChatForbiddenArray {
return s .SortStable (func (a , b ChatForbidden ) bool {
return a .GetID () < b .GetID ()
})
}
func (s ChatForbiddenArray ) FillMap (to map [int64 ]ChatForbidden ) {
for _ , value := range s {
to [value .GetID ()] = value
}
}
func (s ChatForbiddenArray ) ToMap () map [int64 ]ChatForbidden {
r := make (map [int64 ]ChatForbidden , len (s ))
s .FillMap (r )
return r
}
type ChannelArray []Channel
func (s ChannelArray ) Sort (less func (a , b Channel ) bool ) ChannelArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s ChannelArray ) SortStable (less func (a , b Channel ) bool ) ChannelArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s ChannelArray ) Retain (keep func (x Channel ) bool ) ChannelArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s ChannelArray ) First () (v Channel , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s ChannelArray ) Last () (v Channel , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *ChannelArray ) PopFirst () (v Channel , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero Channel
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *ChannelArray ) Pop () (v Channel , 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 ChannelArray ) SortByID () ChannelArray {
return s .Sort (func (a , b Channel ) bool {
return a .GetID () < b .GetID ()
})
}
func (s ChannelArray ) SortStableByID () ChannelArray {
return s .SortStable (func (a , b Channel ) bool {
return a .GetID () < b .GetID ()
})
}
func (s ChannelArray ) SortByDate () ChannelArray {
return s .Sort (func (a , b Channel ) bool {
return a .GetDate () < b .GetDate ()
})
}
func (s ChannelArray ) SortStableByDate () ChannelArray {
return s .SortStable (func (a , b Channel ) bool {
return a .GetDate () < b .GetDate ()
})
}
func (s ChannelArray ) FillMap (to map [int64 ]Channel ) {
for _ , value := range s {
to [value .GetID ()] = value
}
}
func (s ChannelArray ) ToMap () map [int64 ]Channel {
r := make (map [int64 ]Channel , len (s ))
s .FillMap (r )
return r
}
type ChannelForbiddenArray []ChannelForbidden
func (s ChannelForbiddenArray ) Sort (less func (a , b ChannelForbidden ) bool ) ChannelForbiddenArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s ChannelForbiddenArray ) SortStable (less func (a , b ChannelForbidden ) bool ) ChannelForbiddenArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s ChannelForbiddenArray ) Retain (keep func (x ChannelForbidden ) bool ) ChannelForbiddenArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s ChannelForbiddenArray ) First () (v ChannelForbidden , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s ChannelForbiddenArray ) Last () (v ChannelForbidden , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *ChannelForbiddenArray ) PopFirst () (v ChannelForbidden , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero ChannelForbidden
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *ChannelForbiddenArray ) Pop () (v ChannelForbidden , 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 ChannelForbiddenArray ) SortByID () ChannelForbiddenArray {
return s .Sort (func (a , b ChannelForbidden ) bool {
return a .GetID () < b .GetID ()
})
}
func (s ChannelForbiddenArray ) SortStableByID () ChannelForbiddenArray {
return s .SortStable (func (a , b ChannelForbidden ) bool {
return a .GetID () < b .GetID ()
})
}
func (s ChannelForbiddenArray ) FillMap (to map [int64 ]ChannelForbidden ) {
for _ , value := range s {
to [value .GetID ()] = value
}
}
func (s ChannelForbiddenArray ) ToMap () map [int64 ]ChannelForbidden {
r := make (map [int64 ]ChannelForbidden , 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 .