storage

package
v0.0.0-...-4dcdfb1 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2025 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrDuplicate = errors.New("duplicate database entry")

Functions

func GetSettingByKey

func GetSettingByKey[T any](s *Storage, key string) (*T, error)

func SetSetting

func SetSetting[T any](s *Storage, key string, value T) error

Types

type CategoryCounts

type CategoryCounts struct {
	Category string
	Count    int
}

type Storage

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

func NewStorage

func NewStorage(dbConn string) (*Storage, error)
func (s *Storage) AddLink(userId int64, category string, link string, headline string) error

func (*Storage) AddUser

func (s *Storage) AddUser(userId int64, name string) error

func (*Storage) Close

func (s *Storage) Close() error

func (*Storage) DeleteUser

func (s *Storage) DeleteUser(user *models.User) error

func (*Storage) GetResidentMacs

func (s *Storage) GetResidentMacs() (*[]string, error)

func (*Storage) GetUser

func (s *Storage) GetUser(userId int64) (*models.User, error)

func (*Storage) ListCategories

func (s *Storage) ListCategories(userID int64) ([]CategoryCounts, error)

func (*Storage) ListUsers

func (s *Storage) ListUsers() ([]*models.User, error)

func (*Storage) SetResidentMacs

func (s *Storage) SetResidentMacs(macs []string) error

func (*Storage) StoreSession

func (s *Storage) StoreSession(userId int64, chatId int64, lastUserAction time.Time, sessionData string) error

func (*Storage) UserExists

func (s *Storage) UserExists(userId int64) bool

func (*Storage) UserSessions

func (s *Storage) UserSessions() ([]*models.UserSession, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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