Documentation ¶
Overview ¶
Package dialogs contains dialog iteration helper.
Index ¶
- type Elem
- type GetDialogsQueryBuilder
- func (b *GetDialogsQueryBuilder) BatchSize(batchSize int) *GetDialogsQueryBuilder
- func (b *GetDialogsQueryBuilder) Collect(ctx context.Context) ([]Elem, error)
- func (b *GetDialogsQueryBuilder) Count(ctx context.Context) (int, error)
- func (b *GetDialogsQueryBuilder) FolderID(paramFolderID int) *GetDialogsQueryBuilder
- func (b *GetDialogsQueryBuilder) ForEach(ctx context.Context, cb func(context.Context, Elem) error) error
- func (b *GetDialogsQueryBuilder) Iter() *Iterator
- func (b *GetDialogsQueryBuilder) OffsetDate(offsetDate int) *GetDialogsQueryBuilder
- func (b *GetDialogsQueryBuilder) OffsetID(offsetID int) *GetDialogsQueryBuilder
- func (b *GetDialogsQueryBuilder) Query(ctx context.Context, req Request) (tg.MessagesDialogsClass, error)
- type Iterator
- func (m *Iterator) Err() error
- func (m *Iterator) FetchTotal(ctx context.Context) (int, error)
- func (m *Iterator) Next(ctx context.Context) bool
- func (m *Iterator) OffsetDate(offsetDate int) *Iterator
- func (m *Iterator) OffsetID(offsetID int) *Iterator
- func (m *Iterator) OffsetPeer(offsetPeer tg.InputPeerClass) *Iterator
- func (m *Iterator) Total(ctx context.Context) (int, error)
- func (m *Iterator) Value() Elem
- 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 { Dialog tg.DialogClass Last tg.NotEmptyMessage Entities peer.Entities }
Elem is a dialog iterator element.
type GetDialogsQueryBuilder ¶
type GetDialogsQueryBuilder struct {
// contains filtered or unexported fields
}
GetDialogsQueryBuilder is query builder of MessagesGetDialogs.
func (*GetDialogsQueryBuilder) BatchSize ¶
func (b *GetDialogsQueryBuilder) BatchSize(batchSize int) *GetDialogsQueryBuilder
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 (*GetDialogsQueryBuilder) Collect ¶
func (b *GetDialogsQueryBuilder) Collect(ctx context.Context) ([]Elem, error)
Collect creates iterator and collects all elements to slice.
func (*GetDialogsQueryBuilder) Count ¶
func (b *GetDialogsQueryBuilder) Count(ctx context.Context) (int, error)
Count fetches remote state to get number of elements.
func (*GetDialogsQueryBuilder) FolderID ¶
func (b *GetDialogsQueryBuilder) FolderID(paramFolderID int) *GetDialogsQueryBuilder
FolderID sets FolderID field of GetDialogs query.
func (*GetDialogsQueryBuilder) ForEach ¶
func (b *GetDialogsQueryBuilder) ForEach(ctx context.Context, cb func(context.Context, Elem) error) error
ForEach calls given callback on each iterator element.
func (*GetDialogsQueryBuilder) Iter ¶
func (b *GetDialogsQueryBuilder) Iter() *Iterator
Iter returns iterator using built query.
func (*GetDialogsQueryBuilder) OffsetDate ¶
func (b *GetDialogsQueryBuilder) OffsetDate(offsetDate int) *GetDialogsQueryBuilder
OffsetDate sets offsetDate from which iterate start.
func (*GetDialogsQueryBuilder) OffsetID ¶
func (b *GetDialogsQueryBuilder) OffsetID(offsetID int) *GetDialogsQueryBuilder
OffsetID sets offsetID from which iterate start.
func (*GetDialogsQueryBuilder) Query ¶
func (b *GetDialogsQueryBuilder) Query(ctx context.Context, req Request) (tg.MessagesDialogsClass, error)
Query implements Query interface.
type Iterator ¶
type Iterator struct {
// contains filtered or unexported fields
}
Iterator is a dialog 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.
func (*Iterator) OffsetDate ¶
OffsetDate sets OffsetDate request parameter.
func (*Iterator) OffsetPeer ¶
func (m *Iterator) OffsetPeer(offsetPeer tg.InputPeerClass) *Iterator
OffsetPeer sets OffsetPeer request parameter.
type Query ¶
Query is a abstraction for dialogs 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) GetDialogs ¶
func (q *QueryBuilder) GetDialogs() *GetDialogsQueryBuilder
GetDialogs creates query builder of MessagesGetDialogs.