Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type Article ¶
type Article struct { ID uint `json:"-"` Title string `json:"title"` Body string `json:"body"` Description string `json:"description"` Favorited bool `json:"favorited"` FavoritesCount int64 `json:"favoritesCount" db:"favorites_count"` FavoritedBy []*User `json:"-"` Slug string `json:"slug"` AuthorID uint `json:"-" db:"author_id"` Author *User `json:"-"` AuthorProfile *Profile `json:"author"` Tags []*Tag `json:"tagList"` CreatedAt time.Time `json:"createdAt" db:"created_at"` UpdatedAt time.Time `json:"updatedAt" db:"updated_at"` }
func (*Article) SetAuthorProfile ¶
func (*Article) UserHasFavorite ¶
type ArticleFilter ¶
type ArticlePatch ¶
type ArticleService ¶
type ArticleService interface { CreateArticle(context.Context, *Article) error ArticleBySlug(context.Context, string) (*Article, error) Articles(context.Context, ArticleFilter) ([]*Article, error) ArticleFeed(context.Context, *User, ArticleFilter) ([]*Article, error) FavoriteArticle(ctx context.Context, userID uint, article *Article) error UnfavoriteArticle(ctx context.Context, userID uint, article *Article) error UpdateArticle(context.Context, *Article, ArticlePatch) error DeleteArticle(context.Context, uint) error }
type Comment ¶
type Comment struct { ID uint `json:"id"` ArticleID uint `json:"-" db:"article_id"` Article *Article `json:"-"` AuthorID uint `json:"-" db:"author_id"` Author *User `json:"-"` AuthorProfile *Profile `json:"author"` Body string `json:"body"` CreatedAt time.Time `json:"createdAt" db:"created_at"` }
func (*Comment) SetAuthorProfile ¶
type CommentFilter ¶
type CommentService ¶
type Tag ¶
func (Tag) MarshalJSON ¶
type User ¶
type User struct { ID uint `json:"-"` Email string `json:"email,omitempty"` Username string `json:"username,omitempty"` Bio string `json:"bio,omitempty"` Image string `json:"image,omitempty"` Token string `json:"token,omitempty"` Following []*User `json:"-"` Followers []*User `json:"-"` PasswordHash string `json:"-" db:"password_hash"` CreatedAt time.Time `json:"-" db:"created_at"` UpdatedAt time.Time `json:"-" db:"updated_at"` }
var AnonymousUser User
func (*User) IsAnonymous ¶
func (*User) IsFollowing ¶
func (*User) ProfileWithFollow ¶
func (*User) SetPassword ¶
func (User) VerifyPassword ¶
type UserFilter ¶
type UserService ¶
type UserService interface { Authenticate(ctx context.Context, email, password string) (*User, error) CreateUser(context.Context, *User) error UserByID(context.Context, uint) (*User, error) UserByEmail(context.Context, string) (*User, error) UserByUsername(context.Context, string) (*User, error) Users(context.Context, UserFilter) ([]*User, error) UpdateUser(context.Context, *User, UserPatch) error // FollowUser creates a following relationship as follower follows user FollowUser(ctx context.Context, user, follower *User) error // UnFollowUser removes the following relationship as follower unfollows user UnFollowUser(ctx context.Context, user, follower *User) error DeleteUser(context.Context, uint) error }
Click to show internal directories.
Click to hide internal directories.