comments

package
v0.0.0-...-8699099 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 18, 2024 License: MIT Imports: 3 Imported by: 0

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL