Documentation ¶
Overview ¶
Package photos contains photos iteration helper.
Index ¶
- type Elem
- type GetUserPhotosQueryBuilder
- func (b *GetUserPhotosQueryBuilder) BatchSize(batchSize int) *GetUserPhotosQueryBuilder
- func (b *GetUserPhotosQueryBuilder) Collect(ctx context.Context) ([]Elem, error)
- func (b *GetUserPhotosQueryBuilder) Count(ctx context.Context) (int, error)
- func (b *GetUserPhotosQueryBuilder) ForEach(ctx context.Context, cb func(context.Context, Elem) error) error
- func (b *GetUserPhotosQueryBuilder) Iter() *Iterator
- func (b *GetUserPhotosQueryBuilder) Query(ctx context.Context, req Request) (tg.PhotosPhotosClass, error)
- func (b *GetUserPhotosQueryBuilder) UserID(paramUserID tg.InputUserClass) *GetUserPhotosQueryBuilder
- 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 { Photo tg.PhotoClass Entities peer.Entities }
Elem is a photo iterator element.
type GetUserPhotosQueryBuilder ¶
type GetUserPhotosQueryBuilder struct {
// contains filtered or unexported fields
}
GetUserPhotosQueryBuilder is query builder of PhotosGetUserPhotos.
func (*GetUserPhotosQueryBuilder) BatchSize ¶
func (b *GetUserPhotosQueryBuilder) BatchSize(batchSize int) *GetUserPhotosQueryBuilder
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 (*GetUserPhotosQueryBuilder) Collect ¶
func (b *GetUserPhotosQueryBuilder) Collect(ctx context.Context) ([]Elem, error)
Collect creates iterator and collects all elements to slice.
func (*GetUserPhotosQueryBuilder) Count ¶
func (b *GetUserPhotosQueryBuilder) Count(ctx context.Context) (int, error)
Count fetches remote state to get number of elements.
func (*GetUserPhotosQueryBuilder) ForEach ¶
func (b *GetUserPhotosQueryBuilder) ForEach(ctx context.Context, cb func(context.Context, Elem) error) error
ForEach calls given callback on each iterator element.
func (*GetUserPhotosQueryBuilder) Iter ¶
func (b *GetUserPhotosQueryBuilder) Iter() *Iterator
Iter returns iterator using built query.
func (*GetUserPhotosQueryBuilder) Query ¶
func (b *GetUserPhotosQueryBuilder) Query(ctx context.Context, req Request) (tg.PhotosPhotosClass, error)
Query implements Query interface.
func (*GetUserPhotosQueryBuilder) UserID ¶
func (b *GetUserPhotosQueryBuilder) UserID(paramUserID tg.InputUserClass) *GetUserPhotosQueryBuilder
UserID sets UserID field of GetUserPhotos query.
type Iterator ¶
type Iterator struct {
// contains filtered or unexported fields
}
Iterator is a photo 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 a abstraction for photos 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) GetUserPhotos ¶
func (q *QueryBuilder) GetUserPhotos(paramUserID tg.InputUserClass) *GetUserPhotosQueryBuilder
GetUserPhotos creates query builder of PhotosGetUserPhotos.