Documentation ¶
Index ¶
- type ArticleStore
- func (s *ArticleStore) AddFavorite(a *model.Article, u *model.User) error
- func (s *ArticleStore) Create(m *model.Article) error
- func (s *ArticleStore) CreateComment(m *model.Comment) error
- func (s *ArticleStore) Delete(m *model.Article) error
- func (s *ArticleStore) DeleteComment(m *model.Comment) error
- func (s *ArticleStore) DeleteFavorite(a *model.Article, u *model.User) error
- func (s *ArticleStore) GetArticles(tagName, username string, favoritedBy *model.User, limit, offset int64) ([]model.Article, error)
- func (s *ArticleStore) GetByID(id uint) (*model.Article, error)
- func (s *ArticleStore) GetCommentByID(id uint) (*model.Comment, error)
- func (s *ArticleStore) GetComments(m *model.Article) ([]model.Comment, error)
- func (s *ArticleStore) GetFeedArticles(userIDs []uint, limit, offset int64) ([]model.Article, error)
- func (s *ArticleStore) GetTags() ([]model.Tag, error)
- func (s *ArticleStore) IsFavorited(a *model.Article, u *model.User) (bool, error)
- func (s *ArticleStore) Update(m *model.Article) error
- type UserStore
- func (s *UserStore) Create(m *model.User) error
- func (s *UserStore) Follow(a *model.User, b *model.User) error
- func (s *UserStore) GetByEmail(email string) (*model.User, error)
- func (s *UserStore) GetByID(id uint) (*model.User, error)
- func (s *UserStore) GetByUsername(username string) (*model.User, error)
- func (s *UserStore) GetFollowingUserIDs(m *model.User) ([]uint, error)
- func (s *UserStore) IsFollowing(a *model.User, b *model.User) (bool, error)
- func (s *UserStore) Unfollow(a *model.User, b *model.User) error
- func (s *UserStore) Update(m *model.User) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ArticleStore ¶
type ArticleStore struct {
// contains filtered or unexported fields
}
ArticleStore is data access struct for user
func NewArticleStore ¶
func NewArticleStore(db *gorm.DB) *ArticleStore
NewArticleStore returns a new ArticleStore
func (*ArticleStore) AddFavorite ¶
AddFavorite favorite an article
func (*ArticleStore) Create ¶
func (s *ArticleStore) Create(m *model.Article) error
Create creates an article
func (*ArticleStore) CreateComment ¶
func (s *ArticleStore) CreateComment(m *model.Comment) error
CreateComment creates a comment of the article
func (*ArticleStore) Delete ¶
func (s *ArticleStore) Delete(m *model.Article) error
Delete deletes an article
func (*ArticleStore) DeleteComment ¶
func (s *ArticleStore) DeleteComment(m *model.Comment) error
DeleteComment deletes an comment
func (*ArticleStore) DeleteFavorite ¶
DeleteFavorite unfavorite an article
func (*ArticleStore) GetArticles ¶
func (s *ArticleStore) GetArticles(tagName, username string, favoritedBy *model.User, limit, offset int64) ([]model.Article, error)
GetArticles get global articles
func (*ArticleStore) GetByID ¶
func (s *ArticleStore) GetByID(id uint) (*model.Article, error)
GetByID finds an article from id
func (*ArticleStore) GetCommentByID ¶
func (s *ArticleStore) GetCommentByID(id uint) (*model.Comment, error)
GetCommentByID finds an comment from id
func (*ArticleStore) GetComments ¶
GetComments gets coments of the article
func (*ArticleStore) GetFeedArticles ¶
func (s *ArticleStore) GetFeedArticles(userIDs []uint, limit, offset int64) ([]model.Article, error)
GetFeedArticles returns following users' articles
func (*ArticleStore) GetTags ¶
func (s *ArticleStore) GetTags() ([]model.Tag, error)
GetTags creates a article tag
func (*ArticleStore) IsFavorited ¶
IsFavorited returns whether the article is favorited by the user
type UserStore ¶
type UserStore struct {
// contains filtered or unexported fields
}
UserStore is data access struct for user
func (*UserStore) GetByEmail ¶
GetByEmail finds a user from email
func (*UserStore) GetByUsername ¶
GetByUsername finds a user from username
func (*UserStore) GetFollowingUserIDs ¶
GetFollowingUserIDs returns user ids current user follows
func (*UserStore) IsFollowing ¶
IsFollowing returns whether user A follows user B or not