mirror of
https://github.com/johnkerl/miller.git
synced 2026-08-04 05:23:20 +00:00
mlr rename
This commit is contained in:
parent
86f0cfdb14
commit
52fcca1dff
1 changed files with 18 additions and 0 deletions
|
|
@ -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
|
||||
// ================================================================
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue