comment

package
v0.0.0-...-a953039 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CommentCount

func CommentCount(postID primitive.ObjectID) (int64, error)

func Delete

func Delete(id primitive.ObjectID) error

func DeleteByPost

func DeleteByPost(postID primitive.ObjectID) error

func ReplyCount

func ReplyCount(parentID primitive.ObjectID) (int64, error)

Types

type Comment

type Comment struct {
	ID        primitive.ObjectID `json:"id" bson:"_id,omitempty"`
	PostID    primitive.ObjectID `json:"post_id" bson:"post_id,required"`
	UserID    primitive.ObjectID `json:"user_id" bson:"user_id,required"`
	Content   string             `json:"content" bson:"content,required"`
	Parent    primitive.ObjectID `json:"parent" bson:"parent,required"`
	CreatedAt time.Time          `json:"created_at" bson:"created_at,required"`
}

func FindAll

func FindAll(filter bson.M) ([]Comment, error)

func RetrieveAll

func RetrieveAll(postID primitive.ObjectID, parentID primitive.ObjectID, afterID primitive.ObjectID) ([]Comment, error)

func RetrieveDefault

func RetrieveDefault(postID primitive.ObjectID, iteration int) ([]Comment, error)

func RetrieveUserComments

func RetrieveUserComments(userID primitive.ObjectID, postID primitive.ObjectID) ([]Comment, error)

func (*Comment) Save

func (c *Comment) Save() (primitive.ObjectID, error)

Jump to

Keyboard shortcuts

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