mirror of
https://github.com/hanzoai/ai.git
synced 2026-11-20 14:13:23 +00:00
util/string.go has a near-twin in hanzoai/visor, and the two copies of
SnakeString had drifted apart on leading underscores and on non-ASCII
uppercase. This copy's behaviour is the one both now use; the drift was
unreachable in production (the filter path is gated by ReFieldWhiteList,
^[A-Za-z0-9]+$, and all 611 struct field names across both repos are
ASCII with no leading underscore), so nothing here changes. string_test.go
records the agreed output so the copies cannot drift again unnoticed.
The same test pins the acronym behaviour, which reads like a bug and is
not: "OrgID" snakes to "org_i_d", not "org_id". SnakeString feeds ORDER BY
and LIKE in object/, so switching to an acronym-aware mapper (orm's
names.SnakeMapper) would rename 24 live columns. The test is the tripwire
for anyone who tries.
WriteBytesToPath used deprecated ioutil.WriteFile and hand-rolled an
if err != nil { return err }; it is os.WriteFile returned directly. Same
signature, same behaviour, one less import.
Co-authored-by: Hanzo Dev <[email protected]>