pub fn get_links(
base: impl Into<AnyLinkableHash>,
link_type: impl LinkTypeFilterExt,
link_tag: Option<LinkTag>
) -> ExternResult<Vec<Link>>
Expand description
Returns all links that reference a base hash, optionally filtered by link type and tag.
Type can be filtered by providing a variant of the link types or the full range operator. Get links of
all types like this: get_links(base, .., None)
. Refer to the get_links
function in
this coordinator zome
for examples.
Note this will only get links that are defined in dependent integrity zomes.
Tag filtering is a simple bytes prefix.
e.g. if you had these links:
- a:
[ 1, 2, 3]
- b:
[ 1, 2, 4]
- c:
[ 1, 3, 5]
Then tag filters:
[ 1 ]
returns[ a, b, c]
[ 1, 2 ]
returns[ a, b ]
[ 1, 2, 3 ]
returns[ a ]
[ 5 ]
returns[ ]
(does not return c because the filter is by “prefix”, not “contains”)
This is mostly identical to get_link_details
but returns only creates that have not been
deleted, whereas get_link_details
returns all the creates and all the deletes together.
Also note that, unlike when get
is used to retrieve an entry, links that
only differ by author and creation time are not deduplicated; hence, you may receive multiple
links with the same base, tag, and target.
See get_link_details
.