[][src]Function hdk::api::get_entry

pub fn get_entry(address: &Address) -> ZomeApiResult<Option<Entry>>

Retrieves latest version of an entry from the local chain or the DHT, by looking it up using the specified address. Returns None if no entry exists at the specified address or if the entry's status is DELETED. Note that if the entry was updated, the value retrieved may be of the updated entry which will have a different hash value. If you need to get the original value whatever the status, use get_entry_initial, or if you need to know the address of the updated entry use get_entry_result

Examples

pub fn handle_get_post(post_address: Address) -> ZomeApiResult<Option<Entry>> {
    // get_entry returns a Result<Option<T>, ZomeApiError>
    // where T is the type that you used to commit the entry, in this case a Blog
    // It's a ZomeApiError if something went wrong (i.e. wrong type in deserialization)
    // Otherwise its a Some(T) or a None
    hdk::get_entry(&post_address)
}