Module hdk_crud::crud::example[][src]

Expand description

Take a look at this module to get a concrete example of what you need to pass to 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 The 4 Zome functions in this example would be: create_example, fetch_examples, update_example, and delete_example.

Structs

NOT GENERATED This is our example hdk_entry entry type definition.

This is what is expected by a call to update_example

Enums

NOT GENERATED A high level signal type to unify all the entry type specific signal types. Must implement the From<ActionSignal<Example>> trait

Constants

This is the &str that can be passed into Path to find all the entries created using these create functions which are linked off of this Path.

Functions

This is the exposed/public Zome function for creating an entry of this type. This will create an entry and link it off the main Path. It will send a signal of this event to all peers returned by the get_peers call given during the macro call to crud!

This is the exposed/public Zome function for archiving an entry of this type. This will mark the entry at address as “deleted”. It will no longer be returned by fetch_examples. It will send a signal of this event to all peers returned by the get_peers call given during the macro call to crud!

This is the exposed/public Zome function for either fetching ALL or a SPECIFIC list of the entries of the type. No signals will be sent as a result of calling this. Notice that it pluralizes the value of $i, the second argument to the crud! macro call.

Retrieve the Path for these entry types to which all entries are linked

NOT GENERATED This handles the fetching of a list of peers to which to send signals. In this example it’s an empty list. Your function signature should match this function signature.

NOT GENERATED Signal Receiver (forwards signals to the UI) would be handling a

This is the exposed/public Zome function for creating an entry of this type. This will add an update to an entry. It will send a signal of this event to all peers returned by the get_peers call given during the macro call to crud!