I am new to solidity trying to learn it.
I want to create a mapping like
mapping (string=>User[]) public companyUserMap;
Where User is a struct
struct User {
string userId;
uint roleId;
}
Struggling with writing a function for adding / removing/ iterating a user to the mapping.
function addUser() {
User usr= User("user01",1);
User usr2= User("user02",2);
User usr[]={usr,usr2};
//add the users created above to the mapping
companyUserMap.push("c1",usr[])
}
TypeError: Type struct AuthorizationManager.User memory is not implicitly convertible to expected type struct AuthorizationManager.User storage pointer.
Can someone please help me with functions for adding / removing / iterating the users and the mapping