Documentation
¶
Overview ¶
Package util holds small shared helpers.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsCJKFunctionWord ¶
IsCJKFunctionWord reports whether w is a single-ideograph Chinese function word (a high-frequency word with little retrieval signal). Multi-character strings are never function words.
func IsStopword ¶
IsStopword reports whether a lowercase token is a function word (Latin or CJK) that carries no retrieval signal on its own. Retrievers skip these so a match on a common word alone does not trigger a false positive.
func IsUUIDv7 ¶ added in v0.0.11
IsUUIDv7 reports whether s is a canonical lowercase UUIDv7 — the shape UUIDv7 mints, version nibble pinned — so callers may order-compare only ids the timestamp layout actually sorts. An arbitrary foreign string must not win "newer" just because it happens to sort high.
func Tokenize ¶
Tokenize splits text into lowercase word tokens for lexical matching: runs of Latin letters/digits become one token, and each CJK ideograph stands alone (Chinese has no word boundaries, so single ideographs give the overlap signal needed for short-entry retrieval). It is a retrieval heuristic, not a linguistic tokenizer.
func UUIDv7 ¶
UUIDv7 returns a UUID per RFC 9562, strictly increasing within this process.
A new millisecond seeds the 74 payload bits from crypto/rand. The payload increments within a millisecond (including clock rollback), preserving the version and variant bits. Independent processes still have independent clocks and seeds: UUID order is not proof of a peer's attempt identity.
func WriteFileAtomic ¶
WriteFileAtomic writes data to path atomically: the content goes to a temp file in the same directory, is fsynced, and then renamed over path (P1-20). An in-place os.WriteFile leaves a truncated file behind when the process dies mid-write. Replacement visibility and durability depend on the OS and filesystem; Windows briefly retries sharing conflicts with live readers.
Types ¶
This section is empty.