I'd like to return struct type User
. However, when I tried the following getUser
function, it returns an error. Is there any way that struct data would be returned from a function?
Contract
struct User{
uint256 user_id;
bytes32 name;
bytes32 address;
bytes32 birth_day;
}
mapping (uint256 => User) public users;
function getUser(uint256 user_id) constant returns (User) {
return users[user_id];
}
Error
client/lib/contracts/User.sol: Solidity errors: :125:58: Error: Expected type name
function getUser(uint256 user_id) constant returns (struct User) {