Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CommentsPage ¶
func (CommentsPage) MarshalJSON ¶
func (page CommentsPage) MarshalJSON() ([]byte, error)
type LikesPage ¶
func (LikesPage) MarshalJSON ¶
type Page ¶
type Page struct { Total uint64 `db:"total" json:"total"` Offset uint64 `db:"offset" json:"offset"` Limit uint64 `db:"limit" json:"limit"` Tag string `db:"tag,omitempty" json:"tag,omitempty"` PostID string `db:"post_id,omitempty" json:"post_id,omitempty"` Visibility bool `db:"visibility,omitempty" json:"visibility,omitempty"` UserID string `db:"user_id,omitempty" json:"user_id,omitempty"` CommentID string `db:"comment_id,omitempty" json:"comment_id,omitempty"` }
type Post ¶
type Post struct { ID string `bson:"_id,omitempty" json:"id"` Title string `bson:"title" json:"title"` Content string `bson:"content" json:"content"` Tags []string `bson:"tags" json:"tags"` ImageURL string `bson:"image_url" json:"image_url"` Visibility bool `bson:"visibility" json:"visibility"` CreatedAt time.Time `bson:"created_at" json:"created_at"` UpdatedAt time.Time `bson:"updated_at" json:"updated_at"` UserID string `bson:"user_id" json:"user_id"` Comments []Comment `bson:"comments,omitempty" json:"comments,omitempty"` Likes []Like `bson:"likes,omitempty" json:"likes,omitempty"` }
func (Post) MarshalJSON ¶
type PostsPage ¶
func (PostsPage) MarshalJSON ¶
type Repository ¶
type Repository interface { Create(ctx context.Context, post Post) (Post, error) RetrieveByID(ctx context.Context, id string) (Post, error) RetrieveAll(ctx context.Context, page Page) (PostsPage, error) Update(ctx context.Context, post Post) (Post, error) UpdateContent(ctx context.Context, post Post) (Post, error) UpdateTags(ctx context.Context, post Post) (Post, error) UpdateImageURL(ctx context.Context, post Post) (Post, error) UpdateVisibility(ctx context.Context, post Post) (Post, error) Delete(ctx context.Context, id string) error CreateComment(ctx context.Context, postID string, comment Comment) (Comment, error) RetrieveCommentByID(ctx context.Context, id string) (Comment, error) RetrieveAllComments(ctx context.Context, page Page) (CommentsPage, error) UpdateComment(ctx context.Context, comment Comment) (Comment, error) DeleteComment(ctx context.Context, id string) error CreateLike(ctx context.Context, postID string, like Like) (Like, error) RetrieveAllLikes(ctx context.Context, page Page) (LikesPage, error) DeleteLike(ctx context.Context, postID, userID string) error }
type Service ¶
type Service interface { CreatePost(ctx context.Context, token string, post Post) (Post, error) RetrievePostByID(ctx context.Context, token string, id string) (Post, error) RetrieveAllPosts(ctx context.Context, token string, page Page) (PostsPage, error) UpdatePost(ctx context.Context, token string, post Post) (Post, error) UpdatePostContent(ctx context.Context, token string, post Post) (Post, error) UpdatePostTags(ctx context.Context, token string, post Post) (Post, error) UpdatePostImageURL(ctx context.Context, token string, post Post) (Post, error) UpdatePostVisibility(ctx context.Context, token string, post Post) (Post, error) DeletePost(ctx context.Context, token string, id string) error CreateComment(ctx context.Context, token string, postID string, comment Comment) (Comment, error) RetrieveCommentByID(ctx context.Context, token string, id string) (Comment, error) RetrieveAllComments(ctx context.Context, token string, page Page) (CommentsPage, error) UpdateComment(ctx context.Context, token string, comment Comment) (Comment, error) DeleteComment(ctx context.Context, roken, id string) error CreateLike(ctx context.Context, token string, postID string, like Like) (Like, error) RetrieveAllLikes(ctx context.Context, token string, page Page) (LikesPage, error) DeleteLike(ctx context.Context, token string, postID string) error }
func NewService ¶
func NewService(repo Repository, users proto.UsersServiceClient, cacher cache.Cacher) Service
type SharesPage ¶
type SharesPage struct {}
func (SharesPage) MarshalJSON ¶
func (page SharesPage) MarshalJSON() ([]byte, error)
Click to show internal directories.
Click to hide internal directories.