I have a usecase where I need to clear a child element and all children from a document in firebase.
RootLevel.ObjectToClear
Object to clear has a bunch of different data types in it (int, float64, string, map[string]customStruct)
I tried by just creating a blank "object to clear" and overwriting it.
emptyObject := objectToClear{}
rootObject.objectToClear = emptyObject
That seemed to work fine for everything except the map[string]customStruct. I even tried to do an explicit delete of every key in the map and that didn't work either.
for k := range rootObject.objectToClear.MyMap {
delete(rootObject.objectToClear.MyMap, k)
}
If it matters, when I am merging I am using the "MergeAll" function.
firestorehelper.MergeAll(path, workoutMap)
Clearly I am missing something about how the MAP interaction is working but I am not sure what. Any help would be much appreciated.