Hello everyone, right now i have 2 different structures. The first one is a message struct and the 2nd one is a thanks struct. These structures have different fields, i’m new to Elixir and i’m not very sure what is a good approach for parsing from one struct to the other one when the fields are different. To be more precise, i have to parse the 1st one into the 2nd one.
%Message{
date: date,
text: "...",
type: %MesageType{
type: "command",
selector: "/start",
},
from: %Telegram.User{
first_name: "joel",
id: 3132,
last_name: "Ho",
username: "Joel"
},
chat: %Telegram.Chat{
id: 3132,
type: "private",
username: "JH"
}
}
%Thanks{
text: "text",
type: %MesageType{
type: "command",
selector: "/start",
},
chat_id: 3132,
from_user: %User{
username: "JH"
first_name: "Joel"
last_name: "Ho"
chat_id: 3132
},
to_user: %User{
username: "Luis"
first_name: "Luis"
last_name: "Maxwell"
chat_id: 6789
},
}