internal/infra/pg/entitynames.go
internal/infra/pg · 135 lines · 5 declarations · source
Declarations
const MaxEntityNameVariants
const MaxEntityNameVariants = 64
var ErrEntityNameLimit
var ErrEntityNameLimit = errors.New("entity name variants exceed the supported bound")
func retainEntityNameTx
func retainEntityNameTx(ctx context.Context, tx pgx.Tx, schema Schema, scope, source, entity, name, normalized string) error
The source and entity are already locked by resolution. Independent sources keep independent receipts even when their spelling is identical; deleting one cannot remove the other's support.
func refreshEntityNamesTx
func refreshEntityNamesTx(ctx context.Context, tx pgx.Tx, schema Schema, scope, entity string) (bool, error)
Arrays are a bounded display/search cache. Source-owned receipts survive entity loss and provide deterministic reconstruction. A missing entity requires no cache; its original fact can recover it.
func removeEntityNamesTx
func removeEntityNamesTx(ctx context.Context, tx pgx.Tx, schema Schema, scope, subject string, sources []string) (int, error)
Source locks precede entity locks in formation, recovery and removal. Sorting shared endpoints gives overlapping deletion batches the same cache-lock order.