Get an arbitrary key/item from a map

前端 未结 6 1483
攒了一身酷
攒了一身酷 2021-02-01 12:59

I am new to Go and now I want to get an arbitrary item from a map; what\'s the idiomatic way to do that? I can only think of something like this:

func get_some_k         


        
6条回答
  •  闹比i
    闹比i (楼主)
    2021-02-01 13:20

    As a "global" solution, as I am a big fan of elasticsearch, you could use another map/array to store your data, to build a kind of an inverted dictionary.

提交回复
热议问题