reaction.go 865 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. package store
  2. import (
  3. "context"
  4. storepb "github.com/usememos/memos/proto/gen/store"
  5. )
  6. type Reaction struct {
  7. ID int32
  8. CreatedTs int64
  9. CreatorID int32
  10. // ContentID is the id of the content that the reaction is for.
  11. // This can be a memo. e.g. memos/101
  12. ContentID string
  13. ReactionType storepb.ReactionType
  14. }
  15. type FindReaction struct {
  16. ID *int32
  17. CreatorID *int32
  18. ContentID *string
  19. }
  20. type DeleteReaction struct {
  21. ID int32
  22. }
  23. func (s *Store) UpsertReaction(ctx context.Context, upsert *Reaction) (*Reaction, error) {
  24. return s.driver.UpsertReaction(ctx, upsert)
  25. }
  26. func (s *Store) ListReactions(ctx context.Context, find *FindReaction) ([]*Reaction, error) {
  27. return s.driver.ListReactions(ctx, find)
  28. }
  29. func (s *Store) DeleteReaction(ctx context.Context, delete *DeleteReaction) error {
  30. return s.driver.DeleteReaction(ctx, delete)
  31. }