caretta-sync/core/src/proto/cached_address.rs

16 lines
514 B
Rust
Raw Normal View History

2025-08-13 08:17:41 +09:00
use libp2p::Multiaddr;
use crate::cache::entity::CachedAddressModel;
use crate::utils::utc_to_timestamp;
use crate::proto::CachedAddressMessage;
impl From<&CachedAddressModel> for CachedAddressMessage {
fn from(a: &CachedAddressModel) -> Self {
Self {
number: a.id,
2025-08-14 06:38:15 +09:00
created_at: Some(utc_to_timestamp(&a.created_at)),
updated_at: Some(utc_to_timestamp(&a.updated_at)),
2025-08-13 08:17:41 +09:00
multiaddress: Multiaddr::from(a.multiaddress.clone()).to_string(),
}
}
}