-
-
Save guillemcordoba/1b34ee361ed92de81f2c9cda24b88aa9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#[hdk_entry(id = "profile")] | |
struct Post(String); | |
fn query_and_convert_entries<T: HdkEntry>() -> ExternResult<Vec<T>> { | |
// This function already is implemented for any struct that derives hdk_entry, | |
// but there is no trait for us to be able to do this generically | |
let entry_def = T::entry_def(); | |
let filter = ChainQueryFilter::new() | |
.entry_type(EntryType::App(AppEntryType::new( | |
entry_def.id, | |
zome_info!()?.zome_id, | |
EntryVisibility::Private, | |
))) | |
.header_type(HeaderType::Create) | |
.include_entries(true); | |
let query_result: ElementVec = query!(filter)?; | |
Ok(query_result.0) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment