In my smart contract, I have a public mapping as mapping (uint=>User) public users
where User
is a Struct
. Is there any way to get the values of this mapping using a default getter?
For Example : If we have public uint count
, we can simply call it by using Object.count
. Is it possible with mapping as well?
Please help!
Best Answer
First of all, there is no such thing as default setter (mentioned in title of your question).
Now about default getter. Solidity documentation gives the following example:
will generate the following getter:
So, default getter returns not the structure, but rather tuple of all atomic structure fields.
In your case getter will look like: