My code :
def changeset(struct, params) do
struct
|> cast(params, [:id, :title, :description, :user_id, :workspaces_id, :inserted_at, :updated_at])
|> validate_required([:id, :title, :description])
end
def update_change(%{id: 240333852503965697, title: "title", description: "description"} = params) do
params
|> changeset(params)
|> Repo.update()
end
result ->
%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 get only updated fields ->
%Database.Resources.MyApp{
description: "description",
id: 240333852503965697,
title: "title",
updated_at: ~U[2020-03-13 12:59:05Z],
}
How do i do it ?
thank all)))