API reference
Everything exported by github.com/deltamesh/deltamesh as of v1.9.2.
Differ
func NewDiffer(c Codec, opts ...Option) *Differ func (d *Differ) Diff(ctx context.Context, a, b io.Reader) (*Patch, error) func (d *Differ) DiffTo(ctx context.Context, a, b io.Reader, w io.Writer) error
DiffTo never builds the patch in memory and is the right choice when the result is written straight to disk or to the network.
Applier
func NewApplier(c Codec, opts ...Option) *Applier func (a *Applier) Apply(ctx context.Context, src io.Reader, p *Patch, dst io.Writer) error func (a *Applier) Invert(p *Patch) (*Patch, error)
Codecs
| Constructor | Handles | Notes |
|---|---|---|
JSON() | RFC 8259 documents | Numbers preserved as written |
Proto(md) | Protobuf messages | Requires a descriptor |
Arrow(schema) | Record batches | Column-wise diffing |
NDJSON() | Line-delimited JSON | Each line is a top-level entry |
Error codes
| Sentinel | Meaning | Retryable |
|---|---|---|
ErrTooDeep | Nesting exceeded WithMaxDepth | No |
ErrMalformed | Input is not valid for the codec | No |
ErrPathMissing | Patch references a path absent from the source | No |
ErrVersionSkew | Patch was produced by an incompatible major version | No |
ErrShortRead | Underlying reader ended mid-value | Yes |
All errors wrap the underlying cause, so
errors.Is and errors.As work as expected.