I have coded a smart contract which allows one to store a certain type of structure of datas which can be described as something like that :
├── Client1(Contract)
│ ├── Year2018 (Struct containing string,uint and struct)
│ │ ├── Case 1 (Struct containing string)
│ │ └── Case 2 (Struct containing string)
│ └── Year2017
│ └── Case 1 (Struct containing string)
├── Client 2
│ └── Year2018
│ ├──Case1 (Struct containing string)
│ └──Case2 (You got it)
I managed to fill it correctly and parse it too ( But only one case INDIVIDUALLY). I would like to be able to have a function which returns all the datas in a organized way (such as a multi-dimensionnal array or a JSON for example). What should I use ? Is it possible to store all these value in a bytes array ?
Thanks for your ideas and have a good day !
EDIT:
Should i try something like this ?
function massImport(bytes[] _datas) view external onlyOwner(){
for(uint i = 0;i<_datas.length;i++){
addYear(bytes(_datas[i]));
for(uint j = 0; j<_datas[i].length;j++){
addCase(bytes(_datas[i][j]));
}
}
}
I typed the function bytes()
because I assume that bytes are the only possible array in this case?
EDIT 2 : Here is the struct 'YEAR'
struct Year{
string entryName;
string entryYear;
uint permissionType;
Elem elem;
uint[] elemList;
mapping(uint => Elem) allElem;
uint elemId;
}
Do you think that it's too heavy to be stored fully on the blockchain ?