Documentation ¶
Overview ¶
Package peer conatains some peer resolving and extracting helpers.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Entities ¶
type Entities struct {
// contains filtered or unexported fields
}
Entities is simple peer entities storage.
func EntitiesFromResult ¶
func EntitiesFromResult(r EntitySearchResult) Entities
EntitiesFromResult fills Entities struct using given context.
func EntitiesFromUpdate ¶
func EntitiesFromUpdate(uctx tg.UpdateContext) Entities
EntitiesFromUpdate fills Entities struct using given context.
func NewEntities ¶
func NewEntities( users map[int]*tg.User, chats map[int]*tg.Chat, channels map[int]*tg.Channel, ) Entities
NewEntities creates new Entities struct.
func (Entities) ExtractPeer ¶
ExtractPeer finds and creates InputPeerClass using given PeerClass.
func (Entities) Fill ¶
func (ent Entities) Fill( users map[int]*tg.User, chats map[int]*tg.Chat, channels map[int]*tg.Channel, )
Fill adds and updates all entities from given maps.
func (Entities) FillFromResult ¶
func (ent Entities) FillFromResult(r EntitySearchResult)
FillFromResult adds and updates all entities from given result.
func (Entities) FillFromUpdate ¶
func (ent Entities) FillFromUpdate(uctx tg.UpdateContext)
FillFromUpdate adds and updates all entities from given updates.
type EntitySearchResult ¶
type EntitySearchResult interface { MapChats() tg.ChatClassArray MapUsers() tg.UserClassArray }
EntitySearchResult is abstraction for different RPC responses which contains entities.
type LRUResolver ¶
type LRUResolver struct {
// contains filtered or unexported fields
}
LRUResolver is simple decorator for Resolver to cache result in LRU.
func NewLRUResolver ¶
func NewLRUResolver(next Resolver, capacity int) *LRUResolver
NewLRUResolver creates new LRUResolver.
func (*LRUResolver) Resolve ¶
func (l *LRUResolver) Resolve(ctx context.Context, domain string) (tg.InputPeerClass, error)
Resolve implements Resolver.
type Resolver ¶
Resolver is a abstraction to resolve domains and Telegram deeplinks
func DefaultResolver ¶
DefaultResolver creates and returns default resolver.
type ResolverFunc ¶
ResolverFunc is a functional adapter for Resolver.
func (ResolverFunc) Resolve ¶
func (p ResolverFunc) Resolve(ctx context.Context, domain string) (tg.InputPeerClass, error)
Resolve implements Resolver.