storage

package
v1.0.0-my-beta32 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2024 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultUsername   = ""
	DefaultAccessHash = 0
)
View Source
const LatestVersion = 1

Variables

This section is empty.

Functions

This section is empty.

Types

type EntityType

type EntityType int
const (
	TypeUser EntityType
	TypeChat
	TypeChannel
)

func (EntityType) GetInt

func (e EntityType) GetInt() int

type Peer

type Peer struct {
	ID         int64 `gorm:"primary_key"`
	AccessHash int64
	Type       int
	Username   string
}

type PeerStorage

type PeerStorage struct {
	SqlSession *gorm.DB
	// contains filtered or unexported fields
}

func NewPeerStorage

func NewPeerStorage(sessionName string, inMemory bool) *PeerStorage

func (*PeerStorage) AddPeer

func (p *PeerStorage) AddPeer(iD, accessHash int64, peerType EntityType, userName string)

func (*PeerStorage) GetInputPeerById

func (p *PeerStorage) GetInputPeerById(iD int64) tg.InputPeerClass

GetInputPeerById finds the provided id in the peer storage and return its tg.InputPeerClass if found.

func (*PeerStorage) GetInputPeerByUsername

func (p *PeerStorage) GetInputPeerByUsername(userName string) tg.InputPeerClass

GetInputPeerByUsername finds the provided username in the peer storage and return its tg.InputPeerClass if found.

func (*PeerStorage) GetPeerById

func (p *PeerStorage) GetPeerById(iD int64) *Peer

GetPeerById finds the provided id in the peer storage and return it if found.

func (*PeerStorage) GetPeerByUsername

func (p *PeerStorage) GetPeerByUsername(username string) *Peer

GetPeerByUsername finds the provided username in the peer storage and return it if found.

func (*PeerStorage) GetSession

func (p *PeerStorage) GetSession() *Session

GetSession returns the session saved in storage.

func (*PeerStorage) UpdateSession

func (p *PeerStorage) UpdateSession(session *Session)

type Session

type Session struct {
	Version int `gorm:"primary_key"`
	Data    []byte
}

Jump to

Keyboard shortcuts

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