pg
pg copied to clipboard
Recursive Update
Hello,
Did you know if it there is a way to recursively update a nested struct ?
Exemple :
type A struct {
Id int
Name string
B B
}
type B struct {
Id int
Age int
C C
}
type C struct {
Id int
Address string
}
// then update A,B,C in only one operation
a := A{
Id: 1,
Name: "test",
B: B{
Id: 1,
Age: 10,
C: C{
Id: 1,
Address: "test address",
},
},
}
err := db.Update(a)
@bastien-solutions you might find https://github.com/eleanorhealth/milo to be useful for this.
Thank you @fterrag !