post

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: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CountReaction

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

func Delete

func Delete(id primitive.ObjectID) error

func DeleteReaction

func DeleteReaction(filter bson.M) error

func DeleteReactionByPost

func DeleteReactionByPost(postID primitive.ObjectID) error

func GetReaction

func GetReaction(postID primitive.ObjectID, userID primitive.ObjectID) (int, error)

Types

type Post

type Post struct {
	ID        primitive.ObjectID   `json:"id" bson:"_id,omitempty"`
	AuthorID  primitive.ObjectID   `json:"author" bson:"author,required"`
	Content   string               `json:"content" bson:"content,required"`
	ImageIDs  []primitive.ObjectID `json:"image" bson:"image,required"`
	CreatedAt time.Time            `json:"createdAt" bson:"createdAt,required"`
}

func FindNewer

func FindNewer(newerThan primitive.ObjectID) ([]Post, error)

func FindNewerOrOlder

func FindNewerOrOlder(anchor primitive.ObjectID, newer bool) ([]Post, error)

func FindOlder

func FindOlder(olderThan primitive.ObjectID) ([]Post, error)

func FindOne

func FindOne(filter bson.M) (*Post, error)

func RetrievePosts

func RetrievePosts(filter bson.M, iteration int64) ([]Post, error)

func (*Post) Save

func (p *Post) Save() (primitive.ObjectID, error)

type Reaction

type Reaction struct {
	ID     primitive.ObjectID `bson:"_id,omitempty" json:"id"`
	PostID primitive.ObjectID `bson:"post_id" json:"post_id"`
	UserID primitive.ObjectID `bson:"user_id" json:"user_id"`
	Value  int                `bson:"value" json:"value"`
}

func (*Reaction) Save

func (r *Reaction) Save() (primitive.ObjectID, error)

Jump to

Keyboard shortcuts

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