Update still not workin
This commit is contained in:
parent
045f3471ec
commit
c5f4427f9f
@ -72,17 +72,12 @@ func (dma *AbstractAccessor) GenericDeleteOne(id string, accessor Accessor) (DBO
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (dma *AbstractAccessor) GenericUpdateOne(set DBObject, id string, accessor Accessor) (DBObject, int, error) {
|
func (dma *AbstractAccessor) GenericUpdateOne(set DBObject, id string, accessor Accessor) (DBObject, int, error) {
|
||||||
changeMap := set.Serialize()
|
|
||||||
r, c, err := accessor.LoadOne(id)
|
r, c, err := accessor.LoadOne(id)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, c, err
|
return nil, c, err
|
||||||
}
|
}
|
||||||
original := r.Serialize()
|
fmt.Println(set.Serialize())
|
||||||
for k, v := range changeMap {
|
id, code, err := mongo.MONGOService.UpdateOne(r.Deserialize(set.Serialize()), id, accessor.GetType())
|
||||||
original[k] = v
|
|
||||||
}
|
|
||||||
fmt.Println(original)
|
|
||||||
id, code, err := mongo.MONGOService.UpdateOne(r.Deserialize(original), id, accessor.GetType())
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
dma.Logger.Error().Msg("Could not update " + id + " to db. Error: " + err.Error())
|
dma.Logger.Error().Msg("Could not update " + id + " to db. Error: " + err.Error())
|
||||||
return nil, code, err
|
return nil, code, err
|
||||||
|
Loading…
Reference in New Issue
Block a user