peerstore

package
v1.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 16, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache struct {
	Peers []Peer `json:"peers"`
}

type Peer

type Peer struct {
	Ref        string    `json:"ref"`
	Kind       string    `json:"kind"`
	ID         int64     `json:"id"`
	AccessHash int64     `json:"access_hash,omitempty"`
	Title      string    `json:"title"`
	Username   string    `json:"username,omitempty"`
	UpdatedAt  time.Time `json:"updated_at"`
}

func FromChannel

func FromChannel(c *tg.Channel) (Peer, bool)

func FromChat

func FromChat(c *tg.Chat) (Peer, bool)

func FromUser

func FromUser(u *tg.User) (Peer, bool)

func (Peer) Input

func (p Peer) Input() (tg.InputPeerClass, error)

type Store

type Store struct {
	// contains filtered or unexported fields
}

func New

func New(dataDir, profile string) Store

func (Store) Load

func (s Store) Load() (Cache, error)

func (Store) Path

func (s Store) Path() string

func (Store) Resolve

func (s Store) Resolve(token string) (tg.InputPeerClass, Peer, error)

func (Store) Save

func (s Store) Save(cache Cache) error

func (Store) Upsert

func (s Store) Upsert(ctx context.Context, peers []Peer) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL