[−][src]Function hdk::query
pub fn query(
entry_type_name: &str,
limit: u32
) -> ZomeApiResult<Vec<HashString>>
Returns a list of entries from your local source chain, that match a given type.
- entry_type_name: Specify type of entry to retrieve
- limit: Max number of entries to retrieve, with
0
indicating unlimited
Once you have the list of addresses of your entries, there is a good likelihood that you will wish to iterate and call get_entry to retrieve each one. Please be aware that the API for this function is subject to change in future versions.
Examples
pub fn handle_my_posts() -> serde_json::Value { match hdk::query("post", 0) { Ok(posts) => json!({"post_addresses": posts}), Err(hdk_error) => hdk_error.to_json(), } }