2023-04-25 18:27:38 +03:00
|
|
|
package store
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
)
|
|
|
|
|
|
|
|
type MemoRelationType string
|
|
|
|
|
|
|
|
const (
|
2023-10-01 09:44:10 +03:00
|
|
|
// MemoRelationReference is the type for a reference memo relation.
|
|
|
|
MemoRelationReference MemoRelationType = "REFERENCE"
|
|
|
|
// MemoRelationComment is the type for a comment memo relation.
|
|
|
|
MemoRelationComment MemoRelationType = "COMMENT"
|
2023-04-25 18:27:38 +03:00
|
|
|
)
|
|
|
|
|
2023-07-06 16:56:42 +03:00
|
|
|
type MemoRelation struct {
|
2023-08-04 16:55:07 +03:00
|
|
|
MemoID int32
|
|
|
|
RelatedMemoID int32
|
2023-04-25 18:27:38 +03:00
|
|
|
Type MemoRelationType
|
|
|
|
}
|
|
|
|
|
2023-07-06 16:56:42 +03:00
|
|
|
type FindMemoRelation struct {
|
2023-08-04 16:55:07 +03:00
|
|
|
MemoID *int32
|
|
|
|
RelatedMemoID *int32
|
2023-04-25 18:27:38 +03:00
|
|
|
Type *MemoRelationType
|
|
|
|
}
|
|
|
|
|
2023-07-06 16:56:42 +03:00
|
|
|
type DeleteMemoRelation struct {
|
2023-08-04 16:55:07 +03:00
|
|
|
MemoID *int32
|
|
|
|
RelatedMemoID *int32
|
2023-04-25 18:27:38 +03:00
|
|
|
Type *MemoRelationType
|
|
|
|
}
|
|
|
|
|
2023-07-06 16:56:42 +03:00
|
|
|
func (s *Store) UpsertMemoRelation(ctx context.Context, create *MemoRelation) (*MemoRelation, error) {
|
2023-09-27 03:43:46 +03:00
|
|
|
return s.driver.UpsertMemoRelation(ctx, create)
|
2023-04-25 18:27:38 +03:00
|
|
|
}
|
|
|
|
|
2023-07-06 16:56:42 +03:00
|
|
|
func (s *Store) ListMemoRelations(ctx context.Context, find *FindMemoRelation) ([]*MemoRelation, error) {
|
2023-09-27 03:43:46 +03:00
|
|
|
return s.driver.ListMemoRelations(ctx, find)
|
2023-04-25 18:27:38 +03:00
|
|
|
}
|
|
|
|
|
2023-07-06 16:56:42 +03:00
|
|
|
func (s *Store) DeleteMemoRelation(ctx context.Context, delete *DeleteMemoRelation) error {
|
2023-09-27 03:43:46 +03:00
|
|
|
return s.driver.DeleteMemoRelation(ctx, delete)
|
2023-04-25 18:27:38 +03:00
|
|
|
}
|