Documentation
¶
Index ¶
- Variables
- type DB
- type Item
- type SQLite
- func (s *SQLite) CleanupItems(window time.Duration) error
- func (s *SQLite) CreateSubscription(subscription *Subscription) error
- func (s *SQLite) CreateTerm(term *Term) error
- func (s *SQLite) DeleteUserSubscriptions(userID string, ids ...string) error
- func (s *SQLite) FilterBySeenItems(items []Item) ([]Item, error)
- func (s *SQLite) FindSubscriptionsToNotify(window time.Duration, limit int) ([]TermSubscription, error)
- func (s *SQLite) GetSubscription(id string) (*Subscription, error)
- func (s *SQLite) GetTerm(id string) (*Term, error)
- func (s *SQLite) GetUserSubscriptions(userID string) ([]TermSubscription, error)
- func (s *SQLite) Migrate(ctx context.Context) error
- func (s *SQLite) SetNotified(subIDs ...string) error
- func (s *SQLite) TrackItems(items ...Item) error
- func (s *SQLite) UpdateSubscription(subscription *Subscription) error
- type Subscription
- type Term
- type TermSubscription
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrConstraintUnique = errors.New("failed unique constraint")
)
Functions ¶
This section is empty.
Types ¶
type DB ¶
type DB interface {
Close() error
Migrate(context.Context) error
CreateSubscription(*Subscription) error
GetSubscription(id string) (*Subscription, error)
UpdateSubscription(*Subscription) error
GetUserSubscriptions(userID string) ([]TermSubscription, error)
FindSubscriptionsToNotify(window time.Duration, limit int) ([]TermSubscription, error)
SetNotified(subIDs ...string) error
DeleteUserSubscriptions(userID string, ids ...string) error
CreateTerm(*Term) error
GetTerm(id string) (*Term, error)
FilterBySeenItems(items []Item) ([]Item, error)
TrackItems(items ...Item) error
CleanupItems(window time.Duration) error
}
type SQLite ¶
func (*SQLite) CreateSubscription ¶
func (s *SQLite) CreateSubscription(subscription *Subscription) error
func (*SQLite) CreateTerm ¶
func (*SQLite) DeleteUserSubscriptions ¶
func (*SQLite) FindSubscriptionsToNotify ¶
func (*SQLite) GetSubscription ¶
func (s *SQLite) GetSubscription(id string) (*Subscription, error)
func (*SQLite) GetUserSubscriptions ¶
func (s *SQLite) GetUserSubscriptions(userID string) ([]TermSubscription, error)
func (*SQLite) SetNotified ¶
func (*SQLite) TrackItems ¶
func (*SQLite) UpdateSubscription ¶
func (s *SQLite) UpdateSubscription(subscription *Subscription) error
type Subscription ¶
type Subscription struct {
ID string
UserID string
TermID string
LastNotifiedAt time.Time
ShopsBitField int
MinPrice *int
MaxPrice *int
}
func (*Subscription) AddShop ¶
func (s *Subscription) AddShop(shop sendico.Shop)
func (*Subscription) Shops ¶
func (s *Subscription) Shops() []sendico.Shop
type TermSubscription ¶
type TermSubscription struct {
Term Term
Subscription Subscription
}
Click to show internal directories.
Click to hide internal directories.