internal/infra/pg/entityinspection.go
internal/infra/pg · 116 lines · 8 declarations · source
Declarations
const EntityPreviewCharacters
const EntityPreviewCharacters = 512
Entity inspection exposes identity behind a record endpoint. It does not infer semantic matches, expand the graph, or return generated descriptions. Project authority is reapplied on every page.
var ErrInvalidEntityPage, ErrEntityNotFound, ErrInvalidEntityIdentity
var (
ErrInvalidEntityPage = errors.New("invalid entity page")
ErrEntityNotFound = errors.New("entity not found")
ErrInvalidEntityIdentity = errors.New("stored entity identity exceeds the supported inspection bounds")
)
type EntityCursor
type EntityCursor struct {
ID string `json:"id"`
}
type EntitySummary
type EntitySummary struct {
ID string `json:"id"`
Kind string `json:"identity_kind"`
NamePreview string `json:"name_preview"`
NameBytes int `json:"name_bytes"`
NameTruncated bool `json:"name_truncated"`
AliasCount int `json:"alias_count"`
FirstSeenAt time.Time `json:"first_seen_at"`
}
type EntityPage
type EntityPage struct {
Entities []EntitySummary `json:"entities"`
Next *EntityCursor `json:"next,omitempty"`
}
type EntityIdentity
type EntityIdentity struct {
ID string `json:"id"`
Kind string `json:"identity_kind"`
Name string `json:"canonical_name"`
Aliases []string `json:"aliases"`
SpeakerSubjectID *string `json:"speaker_subject_id,omitempty"`
FirstSeenAt time.Time `json:"first_seen_at"`
}
method RecordStore.ListEntities
func (s *RecordStore) ListEntities(ctx context.Context, scope string, after *EntityCursor, limit int) (EntityPage, error)
ListEntities is a live inventory ordered by immutable UUID, not an isolation snapshot. Deleting the cursor row cannot move earlier rows into the next page; inserts behind it require a restart.
method RecordStore.InspectEntity
func (s *RecordStore) InspectEntity(ctx context.Context, scope, id string) (EntityIdentity, error)