func (m *StringMap) Rename(from, to string) {
	defer m.Unlock()
	m.Lock()
	v, has := m.M[from]
	if !has {
		return
	}
	m.M[to] = v
	delete(m.M, from)
}
Rename changes a key name in a manner safe for concurrency by adding
the new name with the same value and deleting the old one.
package util
import (
	"encoding/json"
	"fmt"
	"sort"
	"strings"
	"sync"
)
type StringMap struct {
	M map[string]string
	sync.Mutex
}
func NewStringMap() *StringMap {
	m := new(StringMap)
	m.Init()
	return m
}
func ToStringMap(m map[string]interface{}) *StringMap {
	n := NewStringMap()
	defer n.Unlock()
	n.Lock()
	for k, v := range m {
		n.M[k] = v.(string)
	}
	return n
}
func (m *StringMap) Init() {
	defer m.Unlock()
	m.Lock()
	if m.M == nil {
		m.M = make(map[string]string)
		return
	}
	for k := range m.M {
		delete(m.M, k)
	}
}
func (m *StringMap) Get(key string) string {
	defer m.Unlock()
	m.Lock()
	if v, has := m.M[key]; has {
		return v
	}
	return ""
}
func (m *StringMap) Set(key, val string) {
	defer m.Unlock()
	m.Lock()
	m.M[key] = val
}
func (m *StringMap) Delete(keys ...string) {
	defer m.Unlock()
	m.Lock()
	for _, k := range keys {
		delete(m.M, k)
	}
}