Documentation
¶
Index ¶
- func IdToCacheKey(idHex string) string
- type Core
- func (c *Core) Create(ctx context.Context, newLike Like) (Like, error)
- func (c *Core) DeleteByID(ctx context.Context, likeID string) error
- func (c *Core) QueryAllByPostID(ctx context.Context, postID string) ([]Like, error)
- func (c *Core) QueryAllByUserID(ctx context.Context, userID string) ([]Like, error)
- func (c *Core) QueryByID(ctx context.Context, likeID string) (Like, error)
- func (c *Core) Update(ctx context.Context, updatedLike Like) (Like, error)
- type Like
- type NewLike
- type Storer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IdToCacheKey ¶
Types ¶
type Core ¶
type Core struct {
// contains filtered or unexported fields
}
func NewCore ¶
func NewCore(cache cachestore.CacheStore, storer Storer, userStore user.Storer) *Core
func (*Core) QueryAllByPostID ¶
QueryAllByPostID retrieves all likes for a specific post
func (*Core) QueryAllByUserID ¶
type Like ¶
type Like struct {
ID primitive.ObjectID `json:"id,omitempty" bson:"_id,omitempty"`
UserID primitive.ObjectID `json:"user_id,omitempty" bson:"user_id,omitempty"`
PostID int64 `json:"post_id" bson:"post_id,omitempty"`
IsPositive bool `json:"is_positive"`
}
func (Like) CacheExpiration ¶
type Storer ¶
type Storer interface {
Create(ctx context.Context, newLike Like) (Like, error)
QueryByID(ctx context.Context, likeID string) (Like, error)
QueryAllByUserID(ctx context.Context, userID string) ([]Like, error)
QueryAllByPostID(ctx context.Context, userID string) ([]Like, error)
Update(ctx context.Context, updatedLike Like) (Like, error)
DeleteByID(ctx context.Context, likeID string) error
}
Click to show internal directories.
Click to hide internal directories.