relationship

package
v0.1.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 15, 2026 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

Package relationship provides domain entities for relationship suggestions.

Index

Constants

View Source
const (
	SuggestionPending   = "pending"
	SuggestionApproved  = "approved"
	SuggestionDismissed = "dismissed"
)

Suggestion status constants.

Variables

View Source
var (
	ErrSuggestionNotFound = fmt.Errorf("%w: suggestion not found", shared.ErrNotFound)
)

Errors.

Functions

This section is empty.

Types

type Suggestion

type Suggestion struct {
	// contains filtered or unexported fields
}

Suggestion represents a suggested relationship between two assets.

func NewSuggestion

func NewSuggestion(
	tenantID, sourceAssetID, targetAssetID shared.ID,
	relType, reason string,
	confidence float64,
) (*Suggestion, error)

NewSuggestion creates a new Suggestion with validation.

func ReconstituteSuggestion

func ReconstituteSuggestion(
	id, tenantID, sourceAssetID, targetAssetID shared.ID,
	relType, reason string,
	confidence float64,
	status string,
	reviewedBy *shared.ID,
	reviewedAt *time.Time,
	createdAt time.Time,
) *Suggestion

ReconstituteSuggestion rebuilds a Suggestion from persistence.

func (*Suggestion) Approve

func (s *Suggestion) Approve(reviewerID shared.ID)

Approve marks the suggestion as approved.

func (*Suggestion) Confidence

func (s *Suggestion) Confidence() float64

func (*Suggestion) CreatedAt

func (s *Suggestion) CreatedAt() time.Time

func (*Suggestion) Dismiss

func (s *Suggestion) Dismiss(reviewerID shared.ID)

Dismiss marks the suggestion as dismissed.

func (*Suggestion) ID

func (s *Suggestion) ID() shared.ID

func (*Suggestion) Reason

func (s *Suggestion) Reason() string

func (*Suggestion) RelationshipType

func (s *Suggestion) RelationshipType() string

func (*Suggestion) ReviewedAt

func (s *Suggestion) ReviewedAt() *time.Time

func (*Suggestion) ReviewedBy

func (s *Suggestion) ReviewedBy() *shared.ID

func (*Suggestion) SetAssetInfo

func (s *Suggestion) SetAssetInfo(srcName, srcType, tgtName, tgtType string)

SetAssetInfo sets enrichment fields (called by repository after JOIN).

func (*Suggestion) SourceAssetID

func (s *Suggestion) SourceAssetID() shared.ID

func (*Suggestion) SourceAssetName

func (s *Suggestion) SourceAssetName() string

func (*Suggestion) SourceAssetType

func (s *Suggestion) SourceAssetType() string

func (*Suggestion) Status

func (s *Suggestion) Status() string

func (*Suggestion) TargetAssetID

func (s *Suggestion) TargetAssetID() shared.ID

func (*Suggestion) TargetAssetName

func (s *Suggestion) TargetAssetName() string

func (*Suggestion) TargetAssetType

func (s *Suggestion) TargetAssetType() string

func (*Suggestion) TenantID

func (s *Suggestion) TenantID() shared.ID

func (*Suggestion) UpdateRelationshipType

func (s *Suggestion) UpdateRelationshipType(relType string) error

UpdateRelationshipType changes the suggested relationship type.

type SuggestionRepository

type SuggestionRepository interface {
	Create(ctx context.Context, s *Suggestion) error
	CreateBatch(ctx context.Context, suggestions []*Suggestion) (int, error)
	GetByID(ctx context.Context, tenantID, id shared.ID) (*Suggestion, error)
	ListPending(ctx context.Context, tenantID shared.ID, search string, page pagination.Pagination) (pagination.Result[*Suggestion], error)
	UpdateStatus(ctx context.Context, s *Suggestion) error
	CountPending(ctx context.Context, tenantID shared.ID) (int64, error)
	DeleteByAssetID(ctx context.Context, tenantID, assetID shared.ID) error
	DeletePending(ctx context.Context, tenantID shared.ID) error
	ApproveAll(ctx context.Context, tenantID, reviewerID shared.ID) ([]*Suggestion, error)
	UpdateRelationshipType(ctx context.Context, tenantID, id shared.ID, relType string) error
}

SuggestionRepository defines the persistence interface for suggestions.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL