Feat v0.3.5 settings icd clone #19

Merged
xcaliber merged 3 commits from feat/v0.3.5-settings-icd-clone into main 2026-03-28 13:32:23 +00:00
Showing only changes of commit fe176dbfdd - Show all commits

View File

@@ -14,17 +14,19 @@ import (
"switchboard-core/store/sqlite"
)
// jsonEq compares two JSON byte slices ignoring whitespace differences
// (PG JSONB normalizes spacing, SQLite preserves it verbatim).
// jsonEq compares two JSON byte slices ignoring whitespace and key order
// (PG JSONB normalizes spacing and may reorder keys).
func jsonEq(a, b json.RawMessage) bool {
var ca, cb bytes.Buffer
if err := json.Compact(&ca, a); err != nil {
var va, vb interface{}
if err := json.Unmarshal(a, &va); err != nil {
return false
}
if err := json.Compact(&cb, b); err != nil {
if err := json.Unmarshal(b, &vb); err != nil {
return false
}
return ca.String() == cb.String()
na, _ := json.Marshal(va)
nb, _ := json.Marshal(vb)
return bytes.Equal(na, nb)
}
// testStores returns an appropriate Stores for the current dialect.