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 InputPrivacyRuleClassArray []InputPrivacyRuleClass
func (s InputPrivacyRuleClassArray ) Sort (less func (a , b InputPrivacyRuleClass ) bool ) InputPrivacyRuleClassArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s InputPrivacyRuleClassArray ) SortStable (less func (a , b InputPrivacyRuleClass ) bool ) InputPrivacyRuleClassArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s InputPrivacyRuleClassArray ) Retain (keep func (x InputPrivacyRuleClass ) bool ) InputPrivacyRuleClassArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s InputPrivacyRuleClassArray ) First () (v InputPrivacyRuleClass , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s InputPrivacyRuleClassArray ) Last () (v InputPrivacyRuleClass , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *InputPrivacyRuleClassArray ) PopFirst () (v InputPrivacyRuleClass , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero InputPrivacyRuleClass
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *InputPrivacyRuleClassArray ) Pop () (v InputPrivacyRuleClass , 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 InputPrivacyRuleClassArray ) AsInputPrivacyValueAllowUsers () (to InputPrivacyValueAllowUsersArray ) {
for _ , elem := range s {
value , ok := elem .(*InputPrivacyValueAllowUsers )
if !ok {
continue
}
to = append (to , *value )
}
return to
}
func (s InputPrivacyRuleClassArray ) AsInputPrivacyValueDisallowUsers () (to InputPrivacyValueDisallowUsersArray ) {
for _ , elem := range s {
value , ok := elem .(*InputPrivacyValueDisallowUsers )
if !ok {
continue
}
to = append (to , *value )
}
return to
}
func (s InputPrivacyRuleClassArray ) AsInputPrivacyValueAllowChatParticipants () (to InputPrivacyValueAllowChatParticipantsArray ) {
for _ , elem := range s {
value , ok := elem .(*InputPrivacyValueAllowChatParticipants )
if !ok {
continue
}
to = append (to , *value )
}
return to
}
func (s InputPrivacyRuleClassArray ) AsInputPrivacyValueDisallowChatParticipants () (to InputPrivacyValueDisallowChatParticipantsArray ) {
for _ , elem := range s {
value , ok := elem .(*InputPrivacyValueDisallowChatParticipants )
if !ok {
continue
}
to = append (to , *value )
}
return to
}
type InputPrivacyValueAllowUsersArray []InputPrivacyValueAllowUsers
func (s InputPrivacyValueAllowUsersArray ) Sort (less func (a , b InputPrivacyValueAllowUsers ) bool ) InputPrivacyValueAllowUsersArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s InputPrivacyValueAllowUsersArray ) SortStable (less func (a , b InputPrivacyValueAllowUsers ) bool ) InputPrivacyValueAllowUsersArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s InputPrivacyValueAllowUsersArray ) Retain (keep func (x InputPrivacyValueAllowUsers ) bool ) InputPrivacyValueAllowUsersArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s InputPrivacyValueAllowUsersArray ) First () (v InputPrivacyValueAllowUsers , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s InputPrivacyValueAllowUsersArray ) Last () (v InputPrivacyValueAllowUsers , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *InputPrivacyValueAllowUsersArray ) PopFirst () (v InputPrivacyValueAllowUsers , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero InputPrivacyValueAllowUsers
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *InputPrivacyValueAllowUsersArray ) Pop () (v InputPrivacyValueAllowUsers , 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 InputPrivacyValueDisallowUsersArray []InputPrivacyValueDisallowUsers
func (s InputPrivacyValueDisallowUsersArray ) Sort (less func (a , b InputPrivacyValueDisallowUsers ) bool ) InputPrivacyValueDisallowUsersArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s InputPrivacyValueDisallowUsersArray ) SortStable (less func (a , b InputPrivacyValueDisallowUsers ) bool ) InputPrivacyValueDisallowUsersArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s InputPrivacyValueDisallowUsersArray ) Retain (keep func (x InputPrivacyValueDisallowUsers ) bool ) InputPrivacyValueDisallowUsersArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s InputPrivacyValueDisallowUsersArray ) First () (v InputPrivacyValueDisallowUsers , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s InputPrivacyValueDisallowUsersArray ) Last () (v InputPrivacyValueDisallowUsers , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *InputPrivacyValueDisallowUsersArray ) PopFirst () (v InputPrivacyValueDisallowUsers , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero InputPrivacyValueDisallowUsers
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *InputPrivacyValueDisallowUsersArray ) Pop () (v InputPrivacyValueDisallowUsers , 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 InputPrivacyValueAllowChatParticipantsArray []InputPrivacyValueAllowChatParticipants
func (s InputPrivacyValueAllowChatParticipantsArray ) Sort (less func (a , b InputPrivacyValueAllowChatParticipants ) bool ) InputPrivacyValueAllowChatParticipantsArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s InputPrivacyValueAllowChatParticipantsArray ) SortStable (less func (a , b InputPrivacyValueAllowChatParticipants ) bool ) InputPrivacyValueAllowChatParticipantsArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s InputPrivacyValueAllowChatParticipantsArray ) Retain (keep func (x InputPrivacyValueAllowChatParticipants ) bool ) InputPrivacyValueAllowChatParticipantsArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s InputPrivacyValueAllowChatParticipantsArray ) First () (v InputPrivacyValueAllowChatParticipants , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s InputPrivacyValueAllowChatParticipantsArray ) Last () (v InputPrivacyValueAllowChatParticipants , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *InputPrivacyValueAllowChatParticipantsArray ) PopFirst () (v InputPrivacyValueAllowChatParticipants , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero InputPrivacyValueAllowChatParticipants
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *InputPrivacyValueAllowChatParticipantsArray ) Pop () (v InputPrivacyValueAllowChatParticipants , 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 InputPrivacyValueDisallowChatParticipantsArray []InputPrivacyValueDisallowChatParticipants
func (s InputPrivacyValueDisallowChatParticipantsArray ) Sort (less func (a , b InputPrivacyValueDisallowChatParticipants ) bool ) InputPrivacyValueDisallowChatParticipantsArray {
sort .Slice (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s InputPrivacyValueDisallowChatParticipantsArray ) SortStable (less func (a , b InputPrivacyValueDisallowChatParticipants ) bool ) InputPrivacyValueDisallowChatParticipantsArray {
sort .SliceStable (s , func (i , j int ) bool {
return less (s [i ], s [j ])
})
return s
}
func (s InputPrivacyValueDisallowChatParticipantsArray ) Retain (keep func (x InputPrivacyValueDisallowChatParticipants ) bool ) InputPrivacyValueDisallowChatParticipantsArray {
n := 0
for _ , x := range s {
if keep (x ) {
s [n ] = x
n ++
}
}
s = s [:n ]
return s
}
func (s InputPrivacyValueDisallowChatParticipantsArray ) First () (v InputPrivacyValueDisallowChatParticipants , ok bool ) {
if len (s ) < 1 {
return
}
return s [0 ], true
}
func (s InputPrivacyValueDisallowChatParticipantsArray ) Last () (v InputPrivacyValueDisallowChatParticipants , ok bool ) {
if len (s ) < 1 {
return
}
return s [len (s )-1 ], true
}
func (s *InputPrivacyValueDisallowChatParticipantsArray ) PopFirst () (v InputPrivacyValueDisallowChatParticipants , ok bool ) {
if s == nil || len (*s ) < 1 {
return
}
a := *s
v = a [0 ]
copy (a [0 :], a [1 :])
var zero InputPrivacyValueDisallowChatParticipants
a [len (a )-1 ] = zero
a = a [:len (a )-1 ]
*s = a
return v , true
}
func (s *InputPrivacyValueDisallowChatParticipantsArray ) Pop () (v InputPrivacyValueDisallowChatParticipants , 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 .