I Wanna to create a StoreBasket in Substrate .
I Have Two Struct
one for BusinessItem
.
#[derive(Clone, Encode, Decode, PartialEq, RuntimeDebug, TypeInfo)]
#[scale_info(skip_type_params(T))]
#[codec(mel_bound())]
pub struct BusinessItem {
media: Vec<u8>,
title: Vec<u8>,
description: Vec<u8>,
price: u32,
count: u32,
itemId: [u8; 16],
}
also i Defined Storage For Item:
#[pallet::storage]
#[pallet::getter(fn items)]
pub(super) type Items<T: Config> = StorageMap<_, Twox64Concat, T::AccountId, Vec<BusinessItem>>;
I wanna to find item in item Storage with itemid , for exmaple i have itemId : X0o788dfgg
and i need to find item with this id in storage .
i wrote this code bit it dose not work :
let _itemInfo: Option<&BusinessItem> = items.iter().find(|item| item.itemId == item_id);
whats the problem ? how can i solve this problem ?
StorageDoubleMap
?