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 entry 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 c.f. get_link_details that returns all the creates and all the deletes together.
See get_link_details
.