Documentation ¶
Overview ¶
Package blocked contains blocked contacts iteration helper.
Index ¶
- type Elem
- type GetBlockedQueryBuilder
- func (b *GetBlockedQueryBuilder) BatchSize(batchSize int) *GetBlockedQueryBuilder
- func (b *GetBlockedQueryBuilder) Collect(ctx context.Context) ([]Elem, error)
- func (b *GetBlockedQueryBuilder) Count(ctx context.Context) (int, error)
- func (b *GetBlockedQueryBuilder) ForEach(ctx context.Context, cb func(context.Context, Elem) error) error
- func (b *GetBlockedQueryBuilder) Iter() *Iterator
- func (b *GetBlockedQueryBuilder) MyStoriesFrom(paramMyStoriesFrom bool) *GetBlockedQueryBuilder
- func (b *GetBlockedQueryBuilder) Query(ctx context.Context, req Request) (tg.ContactsBlockedClass, error)
- type Iterator
- type Query
- type QueryBuilder
- type QueryFunc
- type Request
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Elem ¶
type Elem struct { Contact tg.PeerBlocked Entities peer.Entities }
Elem is a contact iterator element.
type GetBlockedQueryBuilder ¶
type GetBlockedQueryBuilder struct {
// contains filtered or unexported fields
}
GetBlockedQueryBuilder is query builder of ContactsGetBlocked.
func (*GetBlockedQueryBuilder) BatchSize ¶
func (b *GetBlockedQueryBuilder) BatchSize(batchSize int) *GetBlockedQueryBuilder
BatchSize sets buffer of message loaded from one request. Be carefully, when set this limit, because Telegram does not return error if limit is too big, so results can be incorrect.
func (*GetBlockedQueryBuilder) Collect ¶
func (b *GetBlockedQueryBuilder) Collect(ctx context.Context) ([]Elem, error)
Collect creates iterator and collects all elements to slice.
func (*GetBlockedQueryBuilder) Count ¶
func (b *GetBlockedQueryBuilder) Count(ctx context.Context) (int, error)
Count fetches remote state to get number of elements.
func (*GetBlockedQueryBuilder) ForEach ¶
func (b *GetBlockedQueryBuilder) ForEach(ctx context.Context, cb func(context.Context, Elem) error) error
ForEach calls given callback on each iterator element.
func (*GetBlockedQueryBuilder) Iter ¶
func (b *GetBlockedQueryBuilder) Iter() *Iterator
Iter returns iterator using built query.
func (*GetBlockedQueryBuilder) MyStoriesFrom ¶
func (b *GetBlockedQueryBuilder) MyStoriesFrom(paramMyStoriesFrom bool) *GetBlockedQueryBuilder
MyStoriesFrom sets MyStoriesFrom field of GetBlocked query.
func (*GetBlockedQueryBuilder) Query ¶
func (b *GetBlockedQueryBuilder) Query(ctx context.Context, req Request) (tg.ContactsBlockedClass, error)
Query implements Query interface.
type Iterator ¶
type Iterator struct {
// contains filtered or unexported fields
}
Iterator is a blocked contacts stream iterator.
func NewIterator ¶
NewIterator creates new iterator.
func (*Iterator) FetchTotal ¶
FetchTotal fetches and returns count of elements.
func (*Iterator) Next ¶
Next prepares the next message for reading with the Value method. It returns true on success, or false if there is no next message or an error happened while preparing it. Err should be consulted to distinguish between the two cases.
type Query ¶
Query is an abstraction for blocked request. NB: iterator mutates returned data (sorts, at least).
type QueryBuilder ¶
type QueryBuilder struct {
// contains filtered or unexported fields
}
QueryBuilder is a helper to create message queries.
func NewQueryBuilder ¶
func NewQueryBuilder(raw *tg.Client) *QueryBuilder
NewQueryBuilder creates new QueryBuilder.
func (*QueryBuilder) GetBlocked ¶
func (q *QueryBuilder) GetBlocked() *GetBlockedQueryBuilder
GetBlocked creates query builder of ContactsGetBlocked.