likedb

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidIDFormat     = fmt.Errorf("invalid ID format")
	ErrLikeCreationFailed  = fmt.Errorf("like creation failed")
	ErrLikeNotFound        = fmt.Errorf("like not found")
	ErrLikeQueryFailed     = fmt.Errorf("failed to query Like by ID")
	ErrLikeUpdateFailed    = fmt.Errorf("like update failed")
	ErrLikeDeletionFailed  = fmt.Errorf("like deletion failed")
	ErrInvalidUserIDFormat = fmt.Errorf("invalid User ID format")
)

Custom errors for Like operations

Functions

func IsInvalidIDFormat

func IsInvalidIDFormat(err error) bool

IsInvalidIDFormat checks if an error is due to invalid ID format.

func IsInvalidUserIDFormat

func IsInvalidUserIDFormat(err error) bool

IsInvalidUserIDFormat checks if an error is due to invalid User ID format.

func IsLikeCreationFailed

func IsLikeCreationFailed(err error) bool

IsLikeCreationFailed checks if an error is due to like creation failure.

func IsLikeDeletionFailed

func IsLikeDeletionFailed(err error) bool

IsLikeDeletionFailed checks if an error is due to like deletion failure.

func IsLikeNotFound

func IsLikeNotFound(err error) bool

IsLikeNotFound checks if an error is due to a like not being found.

func IsLikeUpdateFailed

func IsLikeUpdateFailed(err error) bool

IsLikeUpdateFailed checks if an error is due to like update failure.

Types

type Store

type Store struct {
	// contains filtered or unexported fields
}

func NewStore

func NewStore(log *zerolog.Logger, client *mongo.Client) *Store

func (*Store) Create

func (s *Store) Create(ctx context.Context, newLike like.Like) (like.Like, error)

Create inserts a new Like document into the collection.

func (*Store) DeleteByID

func (s *Store) DeleteByID(ctx context.Context, likeID string) error

DeleteByID removes a Like document by its ID.

func (*Store) QueryAllByPostID

func (s *Store) QueryAllByPostID(ctx context.Context, postID string) ([]like.Like, error)

QueryAllByPostID retrieves all Like documents for a specific post.

func (*Store) QueryAllByUserID

func (s *Store) QueryAllByUserID(ctx context.Context, userID string) ([]like.Like, error)

QueryAllByUserID retrieves all Like documents for a specific user.

func (*Store) QueryByID

func (s *Store) QueryByID(ctx context.Context, likeID string) (like.Like, error)

QueryByID retrieves a Like document by its ID.

func (*Store) Update

func (s *Store) Update(ctx context.Context, updatedLike like.Like) (like.Like, error)

Update modifies an existing Like document.

Jump to

Keyboard shortcuts

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