store

package
v0.0.0-...-84b55d0 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NotFoundError = errors.New("record not found")

Functions

func NewBoltStore

func NewBoltStore(filename string) (*bboltStore, error)

Types

type Chat

type Chat struct {
	AuthPhone    string
	AuthCode     string
	DeleteMsgIDs []int
	ID           int64
	ReplyMsgID   int
	Navigation   Navigation
}

type Client

type Client struct {
	LastConnectionAt time.Time
	LogInAt          time.Time
	SentReports      map[string]Report // [url]report
	Phone            string
	Session          []byte
	IsAuthorized     bool
}
type Navigation int
const (
	LogInCommand  = "login"
	LogOutCommand = "logout"
	StartCommand  = "start"

	WelcomeNavigation Navigation = iota
	PhoneNavigation
	CodeNavigation
	Pass2faNavigation
	UserNavigation
	SharePhoneNavigation
	SplitCode1Navigation
	SplitCode2Navigation
)

type Rashist

type Rashist struct {
	CreatedAt  time.Time
	URL        string
	ResolveErr string
}

type Report

type Report struct {
	CreatedAt time.Time
	Text      string
	URL       string
}

type Store

type Store interface {
	GetUser(id int64) (User, error)
	PutUser(user User) error
	GetUsers() ([]User, error)
	GetRashist(url string) (Rashist, error)
	PutRashist(rashist Rashist) error
	GetRashists() ([]Rashist, error)
	PutRashists([]Rashist) error
	Close() error
}

type User

type User struct {
	Clients map[string]*Client // [phone]client
	Chats   map[int64]*Chat    // [chatID]struct
	Phone   string
	ID      int64
}

Jump to

Keyboard shortcuts

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