A JSON patch module to exchange data compatible with the JS Package Pigeon.
No, this is a very early unfinished version. Please use with caution.
package main
import (
"fmt"
pigeongo "github.com/pkuebler/pigeon-go"
)
func main() {
doc := pigeongo.NewDocument([]byte(`{ "name": "Philipp" }`))
doc.ApplyChanges(Changes{
Diff: []Operation{
{
Op: "replace",
Path: "/name",
Value: rawMessage(`"Phil"`),
Prev: rawMessage(`"Philipp"`),
},
},
Ts: 2,
Cid: "50reifj9hyt",
Gid: "dva96nqsdd",
})
// Print JSON
fmt.Println(doc.JSON)
// Print Warnings
fmt.Println(doc.Warning)
}
pigeongo.NewDocument([]byte(`[{ "attrs": { "id": 123 }, "name": "Philipp" }]`), pigeongo.WithCustomIdentifier([][]string{{"id"},{"attrs", "id"}}))