mirror of
https://github.com/WiiLink24/wfc-server.git
synced 2026-05-06 22:43:27 -05:00
17 lines
385 B
Go
17 lines
385 B
Go
package common
|
|
|
|
import "reflect"
|
|
|
|
func UNUSED(v ...interface{}) {
|
|
}
|
|
|
|
func ReverseMap(m interface{}) interface{} {
|
|
inputType := reflect.TypeOf(m)
|
|
inputValue := reflect.ValueOf(m)
|
|
result := reflect.MakeMap(reflect.MapOf(inputType.Elem(), inputType.Key()))
|
|
for _, key := range inputValue.MapKeys() {
|
|
result.SetMapIndex(inputValue.MapIndex(key), key)
|
|
}
|
|
return result.Interface()
|
|
}
|