storage

package
v0.0.0-...-3c76feb Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Storage

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

Storage is the main storage medium

func NewStorage

func NewStorage() *Storage

NewStorage creates a new Storage

func (*Storage) AddNewQuery

func (s *Storage) AddNewQuery(term string, city string, radius int, price *int, minPrice *int, chatID int64) (*model.Query, error)

AddNewQuery adds a new query to the db

func (*Storage) CloseDB

func (s *Storage) CloseDB()

CloseDB closes the created tb connection

func (*Storage) DeleteOlderAds

func (s *Storage) DeleteOlderAds() (int64, error)

DeleteOlderAds deletes all ads older that 7 days

func (*Storage) FindQueryByID

func (s *Storage) FindQueryByID(id uint) *model.Query

FindQueryByID find a query by the given id

func (*Storage) GetLatest

func (s *Storage) GetLatest(id uint) []scraper.Ad

GetLatest fetches the latest ads from kleinanzeigen. All ads where the id is not in the db is returned and the db is updated with the latest ads

func (*Storage) GetQueries

func (s *Storage) GetQueries() []model.Query

GetQueries gets all the queries from the db

func (*Storage) ListForChatID

func (s *Storage) ListForChatID(chatID int64) []model.Query

ListForChatID gets all the queries for specified chatId

func (*Storage) RemoveByChatID

func (s *Storage) RemoveByChatID(chatID int64) (int, error)

RemoveByChatID removes all queries for a chat id

func (*Storage) RemoveByID

func (s *Storage) RemoveByID(id uint, chatID int64) *model.Query

RemoveByID removes a query by id

Jump to

Keyboard shortcuts

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