MCPcopy Create free account
hub / github.com/PerpetualSoftware/pad / StructuredEntryIDKey

Function StructuredEntryIDKey

internal/models/structured_entry_ids.go:35–43  ·  view source on GitHub ↗

StructuredEntryIDKey is the ONE rule for what a structured entry's stored id means as a timeline id (BUG-2783, BUG-2788). It returns the key the entry claims and whether its raw id is usable at all: - a raw id that is empty, not valid UTF-8, or carries a NUL is unusable; - a raw id that could be co

(raw, prefix string)

Source from the content-addressed store, hash-verified

33// are exactly the ones the timeline would otherwise have put on its
34// index-dependent positional fallback, and no others.
35func StructuredEntryIDKey(raw, prefix string) (key string, usable bool) {
36 if raw == "" || !utf8.ValidString(raw) || strings.ContainsRune(raw, 0) {
37 return "", false
38 }
39 if uuid.Validate(raw) == nil || hasStructuredEntryPrefix(raw) {
40 return prefix + ":" + raw, true
41 }
42 return raw, true
43}
44
45// Why a UUID-SHAPED raw id is diverted. This reasoning is BUG-2783's,
46// unchanged; it moved here from the timeline's looksLikeRowID with the rule

Callers 3

EnsureStructuredEntryIDsFunction · 0.85

Calls 2

hasStructuredEntryPrefixFunction · 0.85
ValidateMethod · 0.45

Tested by 1