linkable

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const CachePrefix = "persist/suggestions/linkable/"

Variables

This section is empty.

Functions

func DeleteSuggestion

func DeleteSuggestion(ctx context.Context, app *app.App, suggestionKey string) error

DeleteSuggestion actually deletes a cache entry for the suggestion identified by suggestionKey. Note that the suggestion is likely to get re-created the next time FindLinkableCustomers is executed if the root cause of the suggestion did not change.

func FindLinkableCustomers

func FindLinkableCustomers(ctx context.Context) error

FindLinkableCustomers searches the complete customer database for customer-records that are likely to describe the same contact and can therefore be linked together. The found suggestions are persisted in the application cache using "persist/suggestions/linkable/<reason>/<value>".

func LinkCustomers

func LinkCustomers(ctx context.Context, app *app.App, suggestion Suggestion) error

LinkCustomers links all customers in suggestion. All customers will be linked to primary. If Primary is empty, the customer of the preferred source is used as the primary. If no preferred source is available, the first customer of the suggestion is used as the primary.

func MarkFalsePositive

func MarkFalsePositive(ctx context.Context, app *app.App, suggestionKey string) error

MarkFalsePositive marks a customer-link suggestion as false-positive.

func RegisterOn

func RegisterOn(mng *tasks.Manager) (*tasks.Task, error)

RegisterOn registers a task executing FindLinkableCustomers on mng.

Types

type Reason

type Reason string
var (
	SameName  Reason = "same-name"
	SameMail  Reason = "same-mail"
	SamePhone Reason = "same-phone"
)

type Suggestion

type Suggestion struct {
	FalsePositive bool                   `json:"falsePositive,omitempty" bson:"falsePositive,omitempty"`
	Reason        Reason                 `json:"reason,omitempty" bson:"reason,omitempty"`
	Value         string                 `json:"value,omitempty" bson:"value,omitempty"`
	Refs          []*v1alpha.CustomerRef `json:"refs,omitempty" bson:"refs,omitempty"`
	Primary       *v1alpha.CustomerRef   `json:"primary,omitempty" bson:"primary,omitempty"`
}

Jump to

Keyboard shortcuts

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