anchor.diff:  %% Sets given links to the document with given key.
   %% @end
   %%--------------------------------------------------------------------
  --spec set_links(opt_ctx(), ext_key(), link_spec() | [link_spec()]) ->
  +-spec set_links(opt_ctx(), ext_key() | document(), link_spec() | [link_spec()]) ->
       ok | generic_error().
  +set_links(Ctx, #document{key = Key}, Links) ->
  +    set_links(Ctx, Key, Links);
   set_links(Ctx, Key, {_LinkName, _LinkTarget} = LinkSpec) ->
       set_links(Ctx, Key, [LinkSpec]);
   set_links(Ctx, Key, Links) when is_list(Links) ->
  
positive.code: %% Executes given function for each link of the document given by key - similar to 'foldl'.
  %% @end
  %%--------------------------------------------------------------------
  -spec foreach_link(opt_ctx(), Key :: ext_key(),
      fun((link_name(), link_target(), Acc :: term()) -> Acc :: term()), AccIn :: term()) ->
      {ok, Acc :: term()} | link_error().
  foreach_link(Ctx, Key, Fun, AccIn) ->
      exec_driver(Ctx, foreach_link, [Key, Fun, AccIn]).
  
  
negative.code: %% Adds given links to the document with given key if link does not exist.
  %% @end
  %%--------------------------------------------------------------------
  -spec create_link(opt_ctx(), ext_key() | document(), link_spec()) ->
      ok | create_error().
  create_link(Ctx, #document{key = Key}, Link) ->
      create_link(Ctx, Key, Link);
  create_link(Ctx, Key, Link) ->
      exec_driver(Ctx, create_link, [Key, normalize_link_target(Ctx, Link)]).
  
  