我想存储与键关联的三元组数据。我有这种形式的三元组:
"data1" "data2" "data3"
其中data1
是一个整数。我有一个三倍键的机制。例如"key1"
映射到
["data1", "data2", "data3"]
一个键可以有多个三元组。例如,[4, "data2", "data3"], [1, "data5", "data6"] and [3, "data8", "data9"]
可以映射到"key1"
. 我希望这些三元组按"data1"
字段排序并映射。在这种情况下,
"key1" => {[1, "data5", "data6"] [3, "data8", "data9"] [4, "data2", "data3"]}
我该怎么做这个红宝石?