mlr rename

This commit is contained in:
John Kerl 2020-09-15 16:43:07 -04:00
parent 86f0cfdb14
commit 52fcca1dff

View file

@ -328,6 +328,24 @@ func (this *Mlrmap) GetSelectedValuesJoined(selectedFieldNames []string) (string
return buffer.String(), true
}
// ----------------------------------------------------------------
func (this *Mlrmap) Rename(oldKey *string, newKey *string) bool {
entry := this.findEntry(oldKey)
if entry == nil {
return false
}
copy := *oldKey
entry.Key = &copy
if this.keysToEntries != nil {
delete(this.keysToEntries, *oldKey)
this.keysToEntries[*newKey] = entry
}
return true
}
// ================================================================
// TO BE PORTED
// ================================================================