stretchr / objx

Go package for dealing with maps, slices, JSON and other data.
MIT License
701 stars 75 forks source link

Rewrite Accessor to fix array access issues, also add a Delete method #142

Open Niels-Be opened 1 year ago

Niels-Be commented 1 year ago

Summary

This is a rewrite of the accessor code to fix a lot of issues with access to arrays.

I added some tests that were failing bevor this rewrite.

There should be no breaking changes with this code. However the new code could allow errors to be forwarded to the caller. e.g. for Get() to differentiate between not found and json null value. Or to notify the caller about an invalid path expression.

Maybe add new methods for this?

In this PR all errors are just swallowed to keep compatibility.

Additionally a new Delete method (as requested in #141) is introduced which was trivial to add with the new code.

Checklist

hanzei commented 1 year ago

@Niels-Be Would you be open on writing benchmarks tests for the affected code to measure the performance impact?