memo_relation.go 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. package store
  2. import (
  3. "context"
  4. )
  5. type MemoRelationType string
  6. const (
  7. // MemoRelationReference is the type for a reference memo relation.
  8. MemoRelationReference MemoRelationType = "REFERENCE"
  9. // MemoRelationComment is the type for a comment memo relation.
  10. MemoRelationComment MemoRelationType = "COMMENT"
  11. )
  12. type MemoRelation struct {
  13. MemoID int32
  14. RelatedMemoID int32
  15. Type MemoRelationType
  16. }
  17. type FindMemoRelation struct {
  18. MemoID *int32
  19. RelatedMemoID *int32
  20. Type *MemoRelationType
  21. }
  22. type DeleteMemoRelation struct {
  23. MemoID *int32
  24. RelatedMemoID *int32
  25. Type *MemoRelationType
  26. }
  27. func (s *Store) UpsertMemoRelation(ctx context.Context, create *MemoRelation) (*MemoRelation, error) {
  28. return s.driver.UpsertMemoRelation(ctx, create)
  29. }
  30. func (s *Store) ListMemoRelations(ctx context.Context, find *FindMemoRelation) ([]*MemoRelation, error) {
  31. return s.driver.ListMemoRelations(ctx, find)
  32. }
  33. func (s *Store) DeleteMemoRelation(ctx context.Context, delete *DeleteMemoRelation) error {
  34. return s.driver.DeleteMemoRelation(ctx, delete)
  35. }