storage

package
v1.1.5 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2023 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

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

Variables

View Source
var SESSION *gorm.DB

Functions

func AddPeer

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

func GetInputPeerById

func GetInputPeerById(iD int64) tg.InputPeerClass

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

func GetInputPeerByUsername

func GetInputPeerByUsername(userName string) tg.InputPeerClass

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

func Load

func Load(sessionName string, inMemory bool) error

func UpdateSession

func UpdateSession(session *Session)

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
}

func GetPeerById

func GetPeerById(iD int64) *Peer

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

func GetPeerByUsername

func GetPeerByUsername(username string) *Peer

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

type Session

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

func GetSession

func GetSession() *Session

GetSession returns the session saved in storage.

Jump to

Keyboard shortcuts

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