code: func (c *Connector) Upsert(_ context.Context, ei *dosa.EntityInfo, values map[string]dosa.FieldValue) error {
  	c.lock.Lock()
  	defer c.lock.Unlock()
  
  	valsCopy := copyRow(values)
  	var oldValues map[string]dosa.FieldValue
  	var err error
  	if oldValues, err = c.mergedInsert(ei.Def.Name, ei.Def.Key, valsCopy, overwriteValuesFunc, true); err != nil {
  		return err
  	}
  	for iName, iDef := range ei.Def.Indexes {
  		if oldValues != nil {
  			c.removeItem(iName, ei.Def.UniqueKey(iDef.Key), oldValues)
  		}
  		_, _ = c.mergedInsert(iName, ei.Def.UniqueKey(iDef.Key), valsCopy, overwriteValuesFunc, false)
  	}
  
  	return nil
  }
docs: // Upsert works a lot like CreateIfNotExists but merges the data when it finds an existing row