I am trying to update a clinic using schema lib. I loaded the clinic using
LoadTo but not sure what should I do now. The idea is to read a json file with the fields of the clinic I want to update. Here is a code sample that reproduces the situation (
go run main.go): https://github.com/oren/cayley-docs/blob/611683dba544227420243432406b9172f777e312/how-to-guides/05-update-clinic/main.go#L138-L145
Currently I inserts but it creates another clinic. Is there a way to upsert or do I need to delete it first? If so, how do I delete it?
var clinic Clinic checkErr(schema.LoadTo(nil, h, &clinic, id)) fmt.Println("clinic loaded", clinic) clinic.Address1 = "Seasame st" // TODO: read this from the json file id, err := insert(h, clinic) checkErr(err)