memos/store/memo_relation.go

45 lines
1.1 KiB
Go
Raw Normal View History

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"
)
type MemoRelation struct {
2023-08-04 16:55:07 +03:00
MemoID int32
RelatedMemoID int32
Type MemoRelationType
}
type FindMemoRelation struct {
2023-08-04 16:55:07 +03:00
MemoID *int32
RelatedMemoID *int32
Type *MemoRelationType
}
type DeleteMemoRelation struct {
2023-08-04 16:55:07 +03:00
MemoID *int32
RelatedMemoID *int32
Type *MemoRelationType
}
func (s *Store) UpsertMemoRelation(ctx context.Context, create *MemoRelation) (*MemoRelation, error) {
return s.driver.UpsertMemoRelation(ctx, create)
}
func (s *Store) ListMemoRelations(ctx context.Context, find *FindMemoRelation) ([]*MemoRelation, error) {
return s.driver.ListMemoRelations(ctx, find)
}
func (s *Store) DeleteMemoRelation(ctx context.Context, delete *DeleteMemoRelation) error {
return s.driver.DeleteMemoRelation(ctx, delete)
}