improve id incrementing logic
This commit is contained in:
parent
322d97dc95
commit
93b81308cb
@ -222,9 +222,9 @@ func incrementTagged(item interface{}) interface{} {
|
|||||||
} else {
|
} else {
|
||||||
cur.Set(reflect.ValueOf(incrementInterface(nid)))
|
cur.Set(reflect.ValueOf(incrementInterface(nid)))
|
||||||
}
|
}
|
||||||
}
|
|
||||||
counterColl := DB.Collection(COUNTER_COL)
|
counterColl := DB.Collection(COUNTER_COL)
|
||||||
counterColl.UpdateOne(context.TODO(), bson.M{"collection": incTag.Name}, bson.M{"$set": bson.M{"collection": incTag.Name, "current": cur.Interface()}}, options.UpdateOne().SetUpsert(true))
|
counterColl.UpdateOne(context.TODO(), bson.M{"collection": incTag.Name}, bson.M{"$set": bson.M{"collection": incTag.Name, "current": cur.Interface()}}, options.UpdateOne().SetUpsert(true))
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
return rv.Elem().Interface()
|
return rv.Elem().Interface()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user