Documentation ¶
Index ¶
- Variables
- type Content
- type ContentStorageImpl
- func (s *ContentStorageImpl) AddContent(ctx context.Context, content *model.Content) error
- func (s *ContentStorageImpl) DeleteSourceContents(ctx context.Context, sourceID uint) (int64, error)
- func (s *ContentStorageImpl) HashIDExist(ctx context.Context, hashID string) (bool, error)
- func (s *ContentStorageImpl) Init(ctx context.Context) error
- type GetSubscriptionsOptions
- type GetSubscriptionsResult
- type Source
- type SourceStorageImpl
- func (s *SourceStorageImpl) AddSource(ctx context.Context, source *model.Source) error
- func (s *SourceStorageImpl) Delete(ctx context.Context, id uint) error
- func (s *SourceStorageImpl) GetSource(ctx context.Context, id uint) (*model.Source, error)
- func (s *SourceStorageImpl) GetSourceByURL(ctx context.Context, url string) (*model.Source, error)
- func (s *SourceStorageImpl) GetSources(ctx context.Context) ([]*model.Source, error)
- func (s *SourceStorageImpl) Init(ctx context.Context) error
- func (s *SourceStorageImpl) UpsertSource(ctx context.Context, sourceID uint, newSource *model.Source) error
- type Storage
- type Subscription
- type SubscriptionSortType
- type SubscriptionStorageImpl
- func (s *SubscriptionStorageImpl) AddSubscription(ctx context.Context, subscription *model.Subscribe) error
- func (s *SubscriptionStorageImpl) CountSourceSubscriptions(ctx context.Context, sourceID uint) (int64, error)
- func (s *SubscriptionStorageImpl) CountSubscriptions(ctx context.Context) (int64, error)
- func (s *SubscriptionStorageImpl) DeleteSubscription(ctx context.Context, userID int64, sourceID uint) (int64, error)
- func (s *SubscriptionStorageImpl) GetSubscription(ctx context.Context, userID int64, sourceID uint) (*model.Subscribe, error)
- func (s *SubscriptionStorageImpl) GetSubscriptionsBySourceID(ctx context.Context, sourceID uint, opts *GetSubscriptionsOptions) (*GetSubscriptionsResult, error)
- func (s *SubscriptionStorageImpl) GetSubscriptionsByUserID(ctx context.Context, userID int64, opts *GetSubscriptionsOptions) (*GetSubscriptionsResult, error)
- func (s *SubscriptionStorageImpl) Init(ctx context.Context) error
- func (s *SubscriptionStorageImpl) SubscriptionExist(ctx context.Context, userID int64, sourceID uint) (bool, error)
- func (s *SubscriptionStorageImpl) UpdateSubscription(ctx context.Context, userID int64, sourceID uint, ...) error
- func (s *SubscriptionStorageImpl) UpsertSubscription(ctx context.Context, userID int64, sourceID uint, ...) error
- type User
- type UserStorageImpl
- func (s *UserStorageImpl) CrateUser(ctx context.Context, user *model.User) error
- func (*UserStorageImpl) CreateUser(ctx context.Context, user *model.User) error
- func (s *UserStorageImpl) GetUser(ctx context.Context, id int64) (*model.User, error)
- func (s *UserStorageImpl) Init(ctx context.Context) error
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrRecordNotFound record not found error ErrRecordNotFound = errors.New("record not found") )
Functions ¶
This section is empty.
Types ¶
type Content ¶
type Content interface { Storage // AddContent adds a new article AddContent(ctx context.Context, content *model.Content) error // DeleteSourceContents deletes all articles of a subscription source and returns the number of deleted articles DeleteSourceContents(ctx context.Context, sourceID uint) (int64, error) // HashIDExist checks if an article with the given hash id already exists HashIDExist(ctx context.Context, hashID string) (bool, error) }
type ContentStorageImpl ¶
type ContentStorageImpl struct {
// contains filtered or unexported fields
}
func NewContentStorageImpl ¶
func NewContentStorageImpl(db *gorm.DB) *ContentStorageImpl
func (*ContentStorageImpl) AddContent ¶
func (*ContentStorageImpl) DeleteSourceContents ¶
func (*ContentStorageImpl) HashIDExist ¶
type GetSubscriptionsOptions ¶
type GetSubscriptionsOptions struct { Count int // Number of items to retrieve, -1 to retrieve all Offset int SortType SubscriptionSortType }
type GetSubscriptionsResult ¶
type Source ¶
type Source interface { Storage AddSource(ctx context.Context, source *model.Source) error GetSource(ctx context.Context, id uint) (*model.Source, error) GetSources(ctx context.Context) ([]*model.Source, error) GetSourceByURL(ctx context.Context, url string) (*model.Source, error) Delete(ctx context.Context, id uint) error UpsertSource(ctx context.Context, sourceID uint, newSource *model.Source) error }
Source subscription source storage interface
type SourceStorageImpl ¶
type SourceStorageImpl struct {
// contains filtered or unexported fields
}
func NewSourceStorageImpl ¶
func NewSourceStorageImpl(db *gorm.DB) *SourceStorageImpl
func (*SourceStorageImpl) Delete ¶
func (s *SourceStorageImpl) Delete(ctx context.Context, id uint) error
func (*SourceStorageImpl) GetSourceByURL ¶
func (*SourceStorageImpl) GetSources ¶
func (*SourceStorageImpl) UpsertSource ¶
type Subscription ¶
type Subscription interface { Storage AddSubscription(ctx context.Context, subscription *model.Subscribe) error SubscriptionExist(ctx context.Context, userID int64, sourceID uint) (bool, error) GetSubscription(ctx context.Context, userID int64, sourceID uint) (*model.Subscribe, error) GetSubscriptionsByUserID( ctx context.Context, userID int64, opts *GetSubscriptionsOptions, ) (*GetSubscriptionsResult, error) GetSubscriptionsBySourceID( ctx context.Context, sourceID uint, opts *GetSubscriptionsOptions, ) (*GetSubscriptionsResult, error) CountSubscriptions(ctx context.Context) (int64, error) DeleteSubscription(ctx context.Context, userID int64, sourceID uint) (int64, error) CountSourceSubscriptions(ctx context.Context, sourceID uint) (int64, error) UpdateSubscription( ctx context.Context, userID int64, sourceID uint, newSubscription *model.Subscribe, ) error UpsertSubscription( ctx context.Context, userID int64, sourceID uint, newSubscription *model.Subscribe, ) error }
type SubscriptionSortType ¶
type SubscriptionSortType = int
const (
SubscriptionSortTypeCreatedTimeDesc SubscriptionSortType = iota
)
type SubscriptionStorageImpl ¶
type SubscriptionStorageImpl struct {
// contains filtered or unexported fields
}
func NewSubscriptionStorageImpl ¶
func NewSubscriptionStorageImpl(db *gorm.DB) *SubscriptionStorageImpl
func (*SubscriptionStorageImpl) AddSubscription ¶
func (*SubscriptionStorageImpl) CountSourceSubscriptions ¶
func (*SubscriptionStorageImpl) CountSubscriptions ¶
func (s *SubscriptionStorageImpl) CountSubscriptions(ctx context.Context) (int64, error)
func (*SubscriptionStorageImpl) DeleteSubscription ¶
func (*SubscriptionStorageImpl) GetSubscription ¶
func (*SubscriptionStorageImpl) GetSubscriptionsBySourceID ¶
func (s *SubscriptionStorageImpl) GetSubscriptionsBySourceID( ctx context.Context, sourceID uint, opts *GetSubscriptionsOptions, ) (*GetSubscriptionsResult, error)
func (*SubscriptionStorageImpl) GetSubscriptionsByUserID ¶
func (s *SubscriptionStorageImpl) GetSubscriptionsByUserID( ctx context.Context, userID int64, opts *GetSubscriptionsOptions, ) (*GetSubscriptionsResult, error)
func (*SubscriptionStorageImpl) Init ¶
func (s *SubscriptionStorageImpl) Init(ctx context.Context) error
func (*SubscriptionStorageImpl) SubscriptionExist ¶
func (*SubscriptionStorageImpl) UpdateSubscription ¶
func (*SubscriptionStorageImpl) UpsertSubscription ¶
type User ¶
type User interface { Storage CreateUser(ctx context.Context, user *model.User) error GetUser(ctx context.Context, id int64) (*model.User, error) }
User user storage interface
type UserStorageImpl ¶
type UserStorageImpl struct {
// contains filtered or unexported fields
}
func NewUserStorageImpl ¶
func NewUserStorageImpl(db *gorm.DB) *UserStorageImpl
func (*UserStorageImpl) CreateUser ¶
CreateUser implements User.
Click to show internal directories.
Click to hide internal directories.