I am fairly new to golang and I am struggling to generate a one to many relationship map from existing map.
Here is my script - playground
Explanation:- I am trying to achieve the relation of each element of 0th position to each element of 1st,2nd,…nth position.
For example - [0][0]=>[1][0], [0][0]=>[1][1], [0][1]=>[1][0], [0][1]=>[1][1], [0][0]=>[2][0], [0][1]=>[2][1]
However, I am unable to achieve it.
Final Output which I am trying to achieve -
Array(
[0] => Array
(
[0] => Array
(
[room_rate_key] => 0|0
[amount] => 5307.84
)
[1] => Array
(
[room_rate_key] => 0|0
[amount] => 5307.84
)
)
[1] => Array
(
[0] => Array
(
[room_rate_key] => 0|0
[amount] => 5307.84
)
[1] => Array
(
[room_rate_key] => 0|1
[amount] => 5246.98
)
)
[2] => Array
(
[0] => Array
(
[room_rate_key] => 0|1
[amount] => 5246.98
)
[1] => Array
(
[room_rate_key] => 0|0
[amount] => 5307.84
)
)
[3] => Array
(
[0] => Array
(
[room_rate_key] => 0|1
[amount] => 5246.98
)
[1] => Array
(
[room_rate_key] => 0|1
[amount] => 5246.98
)
)
)
Can someone please help. ?
Thanks .