Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Comment ¶
type Comment struct { ID int64 `json:"id"` // ID is the unique identifier for the comment. PostID int64 `json:"post_id"` // PostID links the comment to the post it belongs to. UserID int64 `json:"user_id"` // UserID links the comment to the user who created it. Content string `json:"content"` // Content holds the main body of the comment. CreatedAt time.Time `json:"created_at"` // CreatedAt is the timestamp when the comment was created. }
Comment represents a comment on a post.
type CommentDetail ¶
type CommentDetail struct { ID int64 `json:"id"` // ID is the unique identifier of the comment. UserID int64 `json:"user_id"` // UserID is the identifier of the user who made the comment. Content string `json:"content"` // Content holds the text of the comment. CreatedAt time.Time `json:"created_at"` // CreatedAt is the timestamp when the comment was created. }
CommentDetail represents the structure of a comment in the response, excluding the post_id field.
type CommentStore ¶
type CommentStore interface { // CreateComment handles the comment creation. CreateComment(ctx context.Context, comment *Comment) error // GetCommentsByPostID retrieves all comments for a given post. GetCommentsByPostID(ctx context.Context, postID int) ([]Comment, error) }
CommentStore defines the contract for a comments store.
func NewCommentStore ¶
func NewCommentStore(dbPool *pgxpool.Pool) CommentStore
NewCommentStore creates a new instance of commentStore, implementing the CommentStore interface.
Click to show internal directories.
Click to hide internal directories.