Simplify: batch M2O, deduplicate formatting, clean dead code

Code reuse:
- formatRecordsForWeb() consolidates 4-call formatting sequence
  (was duplicated in handleWebSearchRead + handleWebRead)
- ToRecordID() public alias for cross-package ID extraction

Performance:
- M2O NameGet now batched: collect all FK IDs per field, single
  NameGet per comodel instead of per-record (N+1 → 1)

Quality:
- normalizeNullFields: 30-line switch (all returning false) → 5 lines
- domain.go: remove unused _ = subParams assignment
- Net -14 lines

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Marc
2026-04-03 01:24:13 +02:00
parent 24dee3704a
commit 70320b6b29
3 changed files with 66 additions and 80 deletions

View File

@@ -269,6 +269,9 @@ func ParseCommands(raw interface{}) ([]Command, bool) {
return cmds, true
}
// ToRecordID extracts an int64 ID from various numeric types. Public alias.
func ToRecordID(v interface{}) (int64, bool) { return toInt64(v) }
func toInt64(v interface{}) (int64, bool) {
switch n := v.(type) {
case float64: