identity

package
v0.1.19 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2026 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Overview

Package identity resolves the many identifiers a person accumulates across sources (email, GitHub login, Jira account id) to one canonical identifier, so one human stays one node in the graph.

Index

Constants

This section is empty.

Variables

View Source
var ErrAliases = errors.New("identity: aliases")

ErrAliases reports a problem reading or parsing an alias file.

Functions

This section is empty.

Types

type Resolver

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

Resolver unions identifiers that belong to the same person and resolves any of them to a single canonical identifier. The canonical pick prefers an email over a bare name slug, and either over a source-prefixed identifier such as "github:alice"; ties break lexically so resolution is deterministic.

func NewResolver

func NewResolver() *Resolver

NewResolver returns an empty resolver where every identifier is its own canonical form.

func (*Resolver) Canonical

func (r *Resolver) Canonical(id model.ID) model.ID

Canonical returns the canonical identifier for id, or id itself when it has never been unioned with anything.

func (*Resolver) LoadFile

func (r *Resolver) LoadFile(path string) error

LoadFile merges an alias file into the resolver. The file is a JSON object mapping a canonical identifier to the list of identifiers that belong to the same person, for example {"alice@corp.com": ["github:alice"]}.

func (*Resolver) Pairs

func (r *Resolver) Pairs() map[model.ID]model.ID

Pairs returns every known identifier mapped to its canonical form, omitting identifiers that are already canonical. The result is nil when the resolver holds nothing worth persisting.

func (*Resolver) Restore

func (r *Resolver) Restore(pairs map[model.ID]model.ID)

Restore replays persisted alias pairs, mapping each identifier back to its canonical form.

func (*Resolver) Union

func (r *Resolver) Union(a, b model.ID)

Union records that a and b identify the same person.

Jump to

Keyboard shortcuts

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