db

package
v0.0.0-...-e082e2d Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var InvalidConditionError = errors.New("invalid condition")
View Source
var InvalidNotificationError = errors.New("invalid notification")
View Source
var InvalidOfferError = errors.New("invalid offer")

Functions

This section is empty.

Types

type ConditionRepository

type ConditionRepository interface {
	Insert(ctx context.Context, condition *model.Condition) error
	Delete(ctx context.Context, id primitive.ObjectID) error
	FindBy(ctx context.Context, by primitive.M) ([]*model.Condition, error)
	FindById(ctx context.Context, id primitive.ObjectID) (*model.Condition, error)
	FindAll(ctx context.Context, limit int64, skip int64) ([]*model.Condition, int64, error)
	GetWasm(ctx context.Context, id primitive.ObjectID) ([]byte, error)
}

type DB

type DB interface {
	GetOfferRepository() OfferRepository
	GetWatchUrlRepository() WatchUrlRepository
	GetConditionRepository() ConditionRepository
	GetNotificationRepository() NotificationRepository
	GetSentNotificationRepository() SentNotificationRepository
	Close(ctx context.Context) error
}

func NewDB

func NewDB(ctx context.Context, dbUrl, dbName string) (DB, error)

type NotificationRepository

type NotificationRepository interface {
	Insert(ctx context.Context, notification *model.Notification, condition *model.Condition) error
	Delete(ctx context.Context, id primitive.ObjectID) error
	FindBy(ctx context.Context, by primitive.M) ([]*model.Notification, error)
	FindAll(ctx context.Context, limit int64, skip int64) ([]*model.Notification, int64, error)
}

type OfferRepository

type OfferRepository interface {
	Insert(ctx context.Context, offer *model.Offer) error
	Update(ctx context.Context, offer *model.Offer) error
	Delete(ctx context.Context, id primitive.ObjectID) error
	FindById(ctx context.Context, id primitive.ObjectID) (*model.Offer, error)
	FindBy(ctx context.Context, by primitive.M) ([]*model.Offer, error)
	FindAll(ctx context.Context, limit int64, skip int64) ([]*model.Offer, int64, error)
}

type SentNotificationRepository

type SentNotificationRepository interface {
	Insert(ctx context.Context, sent *model.SentNotification, notification *model.Notification, offer *model.Offer) error
	FindBy(ctx context.Context, by primitive.M) ([]*model.SentNotification, error)
	Update(ctx context.Context, sent *model.SentNotification) error
}

type WatchUrlRepository

type WatchUrlRepository interface {
	Insert(ctx context.Context, watchUrl *model.WatchUrl) error
	InsertIfNotExists(ctx context.Context, watchUrl *model.WatchUrl) error
	Update(ctx context.Context, watchUrl *model.WatchUrl) error
	Delete(ctx context.Context, id primitive.ObjectID) error
	FindById(ctx context.Context, id primitive.ObjectID) (*model.WatchUrl, error)
	FindBy(ctx context.Context, by primitive.M) ([]*model.WatchUrl, error)
	FindAll(ctx context.Context, limit int64, skip int64) ([]*model.WatchUrl, int64, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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