How can I return to Repo.update only those fields that have been updated so as not to return the entire structure.
example :
def changeset(struct, params) do
struct
|> cast(params, [:id, :title, :type, :description, :user_id, :workspaces_id, :inserted_at, :updated_at])
|> validate_required([:id, :title, :description])
end
def update_change(%{id: 240333852503965697, title: "title", description: "description"}) do
params
|> changeset(params)
|> Repo.update()
end
result return ->
%Database.Resources.MyApp{
deleted_at: nil,
description: "description",
id: 240333852503965697,
inserted_at: ~U[2020-03-13 12:04:32Z],
title: "title",
updated_at: ~U[2020-03-13 12:59:05Z],
user_id: "777f47cb-28af-4b87-a45a-a3368e151190",
workspaces_id: "c9e32ee2-2620-4db7-ac3a-6c30ed5b0f87"
}
I need return only field have been updated
example :
%Database.Resources.MyApp{
description: "description",
id: 240333852503965697,
title: "title",
updated_at: ~U[2020-03-13 12:59:05Z],
}