diff --git a/go/src/miller/types/mlrmap_accessors.go b/go/src/miller/types/mlrmap_accessors.go index 1da20103f..f72773924 100644 --- a/go/src/miller/types/mlrmap_accessors.go +++ b/go/src/miller/types/mlrmap_accessors.go @@ -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 = © + + if this.keysToEntries != nil { + delete(this.keysToEntries, *oldKey) + this.keysToEntries[*newKey] = entry + } + + return true +} + // ================================================================ // TO BE PORTED // ================================================================