Crate hdk_crud[−][src]
Modules
Take a look at this module to get a concrete example of what you need to pass the crud! macro, as well as what you’ll get back out of it. Anything that says “NOT GENERATED” is not generated by the crud! macro call, and the rest is It will generate 4 public Zome functions, as well as some inner functions called by those that you can refer to and call elsewhere. The 4 Zome functions in this example would be: create_example, fetch_examples, update_example, and archive_example.
Macros
A macro to go quick and easy from having just a Holochain entry definition to having a full create-read-update-delete set of functionality in your Zome, plus “signals” (events). See example for a comprehensive look at how this works.
Create 2 special types from an existing type that are optimized as a data structure for sending signals to a UI or client that relate to core Holochain actions for entry types: Create, Update, and Delete
Structs
A version of an [AgentPubKey] that will automatically serialize and deserialize to/from string based hashes for use on your client side. It is used by functions throughout this library. You may wish to use it as a type for your fields on an entry type, if trying to reference an [AgentPubKey].
A version of an [EntryHash] that will automatically serialize and deserialize to/from string based hashes for use on your client side. It is used by functions throughout this library. You may wish to use it as a type for your fields on an entry type, if trying to reference an [EntryHash].
A version of an [HeaderHash] that will automatically serialize and deserialize to/from string based hashes for use on your client side. It is used by functions throughout this library. You may wish to use it as a type for your fields on an entry type, if trying to reference an [HeaderHash].
Enums
when sending signals, distinguish between “create”, “update”, and “delete” actions via this enum. Serializes to/from “create” | “update” | “delete”
Functions
Grant unrestricted access for this agent to receive
calls to its recv_remote_signal
endpoint via others
calling remote_signal
Fetch and deserialize all the entries of a certain type that are linked to an EntryHash. Useful for having a Path that you link everything to. This also internally calls get_latest_for_entry meaning that the contents for each entry returned are automatically the latest contents.
If an entry at the entry_hash
has multiple updates to itself, this
function will sort through them by timestamp in order to return the contents
of the latest update. It also has the special behaviour of returning the
ORIGINAL HeaderHash, as opposed to the HeaderHash of the Header that performed
that latest update. This is useful if you want hashes in your application
to act consistently, almost acting as an “id” in a centralized system.
It simplifies traversal of the update tree, since all updates
made by the client can reference the original, instead of updates reference updates
Type Definitions
A triple of an Entry along with the HeaderHash of that committed entry and the EntryHash of the entry
The same as an EntryAndHash but inside an Option, so it can be Some(…) or None