m_rsc_update (zotonic_core v1.0.0-rc.17)
Resource update helper module used by m_rsc.
This module contains insert/update/delete/merge routines for resources and is logically part of the m_rsc model implementation.
It is not exposed as a standalone model path endpoint.
Summary
Functions
-spec delete(Id, Context) -> ok | {error, atom()} when Id :: m_rsc:resource(), Context :: z:context().
-spec delete(Id, FollowUpId, Context) -> ok | {error, atom()} when Id :: m_rsc:resource(), FollowUpId :: m_rsc:resource(), Context :: z:context().
-spec delete_nocheck(Id, Context) -> ok | {error, atom()} when Id :: m_rsc:resource(), Context :: z:context().
-spec duplicate(Id, Props, Context) -> {ok, NewId} | {error, term()} when Id :: m_rsc:resource(), Props :: m_rsc:props_all(), Context :: z:context(), NewId :: m_rsc:resource_id().
-spec duplicate(Id, Props, Options, Context) -> {ok, NewId} | {error, term()} when Id :: m_rsc:resource(), Props :: m_rsc:props_all(), Options :: m_rsc:duplicate_options(), Context :: z:context(), NewId :: m_rsc:resource_id().
-spec insert(Props, Context) -> {ok, ResourceId} | {error, term()} when Props :: m_rsc:props_all(), Context :: z:context(), ResourceId :: m_rsc:resource_id().
-spec insert(Props, Options, Context) -> {ok, ResourceId} | {error, term()} when Props :: m_rsc:props_all(), Options :: m_rsc:update_options(), Context :: z:context(), ResourceId :: m_rsc:resource_id().
-spec merge_delete(WinnerId, LoserId, Options, Context) -> ok | {error, term()} when WinnerId :: m_rsc:resource(), LoserId :: m_rsc:resource(), Options :: list(), Context :: #context{cowreq :: cowboy_req:req() | undefined, cowenv :: cowboy_middleware:env() | undefined, site :: atom(), controller_module :: atom() | undefined, client_id :: binary() | undefined, client_topic :: mqtt_sessions:topic() | undefined, routing_id :: binary() | undefined, acl :: term() | admin | undefined, acl_is_read_only :: boolean(), user_id :: integer() | authenticated | undefined, render_state :: undefined | z_render:render_state(), db :: {atom(), atom()} | undefined, dbc :: pid() | undefined, language :: [atom()], tz :: binary(), props :: map(), depcache :: pid() | atom(), dispatcher :: pid() | atom(), template_server :: pid() | atom(), scomp_server :: pid() | atom(), dropbox_server :: pid() | atom(), pivot_server :: pid() | atom(), module_indexer :: pid() | atom(), translation_table :: atom()}.
-spec update(IdOrInsert, PropsOrFun, Context) -> {ok, UpdatedId} | {error, term()} when IdOrInsert :: m_rsc:resource() | insert_rsc, PropsOrFun :: m_rsc:props_all() | m_rsc:update_function(), Context :: z:context(), UpdatedId :: m_rsc:resource_id().
-spec update(IdOrInsert, PropsOrFun, Options, Context) -> {ok, UpdatedId} | {error, term()} when IdOrInsert :: m_rsc:resource() | insert_rsc, PropsOrFun :: m_rsc:props_all() | m_rsc:update_function(), Options :: m_rsc:update_options() | boolean(), Context :: z:context(), UpdatedId :: m_rsc:resource_id().
-spec update_translation(Id, Language, Props, Context) -> {ok, UpdatedId} | {error, term()} when Id :: m_rsc:resource(), Language :: z_language:language(), Props :: m_rsc:props_all(), Context :: z:context(), UpdatedId :: m_rsc:resource_id().
-spec update_translation(Id, Language, Props, Options, Context) -> {ok, UpdatedId} | {error, term()} when Id :: m_rsc:resource(), Language :: z_language:language(), Props :: m_rsc:props_all(), Options :: m_rsc:update_options(), Context :: z:context(), UpdatedId :: m_rsc:resource_id().