#one map with different types of 2 maps with 1 type

3 messages · Page 1 of 1 (latest)

reef tapir
#

if querying over admins is something you do very frequently

#

you can have a cached map of admin's key

#

lets say the user's map is map[string]*User where string is the ID of sort
then we can derive another map map[string]*User where only admins from usermap get inserted into it
*note that an admin will be in the user map AND the admin map, and we are using pointers here to keep data consistent, editing the user via the admin map will reflect in the user's map

if you user map is something like this map[string]User, you might do something like a cache slice of all admins's id like this []string