✨ Implement full support for nested fields in Meta and Entry marshalling
This commit completes the implementation of nested field support.
- :
- now correctly handles and by recursively flattening them into format.
- Introduced for recursive map marshalling.
- Refactored for cleaner buffer writing.
- : Added comprehensive test cases for nested JSON, nested maps, double-nested maps, and nested keys within JSON to ensure correct marshalling and unmarshalling.
- : Updated tests to reflect the new nil handling and removed redundant JSON object test.
This allows for more flexible and structured data representation within log entries.
This commit is contained in:
parent
c4e864afa5
commit
4fc1c623a0
3 changed files with 90 additions and 6 deletions
|
|
@ -35,12 +35,11 @@ func TestMeta(t *testing.T) {
|
|||
{"json number", "num", json.Number("42.13"), "@num 42.13", nil, 42.13},
|
||||
{"true", "b", true, "@b true", nil, true},
|
||||
{"false", "b", false, "@b false", nil, false},
|
||||
{"nil", "n", nil, "", nil, ErrorParsing},
|
||||
{"nil", "n", nil, "", ErrorParsing, ErrorParsing},
|
||||
{"time", "when", when, "@when " + when.Format(time.RFC3339), nil, when},
|
||||
{"rune", "char", '@', "@char @", nil, "@"},
|
||||
{"bytes", "byteme", []byte("yo"), "@byteme yo", nil, "yo"},
|
||||
{"byte", "byteme", byte(67), "@byteme C", nil, "C"},
|
||||
{"json-obj", "obj", json.RawMessage(`{"foo":"bar","baz":"quux"}`), `@obj {"foo":"bar","baz":"quux"}`, nil, json.RawMessage(`{"foo":"bar","baz":"quux"}`)},
|
||||
{"json-arr", "arr", json.RawMessage(`["foo",42,"bar", null,"quux", true]`), `@arr ["foo",42,"bar", null,"quux", true]`, nil, json.RawMessage(`["foo",42,"bar", null,"quux", true]`)},
|
||||
{"chan", "nope", make(chan bool), "", errors.New("Unsupported type chan bool"), ""},
|
||||
{"whitespace-key", "no space", "hi", "", errors.New("whitespace is not allowed in key: no space"), ""},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue