Answer the question
In order to leave comments, you need to log in
How to fill in maps in go?
There is such a type: map[int]map[int]map[int]int
To store such a data structure:
-- [ id ]
------ [ group_id ]
---------- [ item_id ]
-------------- [ quantity ]
---------- [ item_id ]
-------------- [ quantity ]
---------- [ item_id ]
-------------- [ quantity ]
------ [ group_id ]
---------- [ item_id ]
-------------- [ quantity ]
--[ id ]
------ [ group_id ]
---------- [ item_id ]
-------------- [ quantity ]
if _, ok := my_map[group_id]; !ok {
my_map[group_id] = make(map[int]int)
}
my_map[group_id][item_id] = quantity
Answer the question
In order to leave comments, you need to log in
Go has OOP, use it. Highlight your Item, Group, etc. at least like this
I am absolutely delighted! The texture is just fabulous!
Subject: Permission!
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question