feat: ✨ getters for package
This commit is contained in:
parent
2b15169bc1
commit
b3e49f414e
1 changed files with 36 additions and 3 deletions
|
@ -1,19 +1,52 @@
|
|||
use std::fmt::Display;
|
||||
|
||||
use sha3::Sha3_512;
|
||||
use surrealdb::Datetime;
|
||||
|
||||
pub(crate) struct Package {
|
||||
name: String,
|
||||
author: Publisher,
|
||||
publisher: Publisher,
|
||||
version: Version,
|
||||
size: u64,
|
||||
hash: String,
|
||||
publish_date_time: Datetime,
|
||||
last_update_date_time: Datetime,
|
||||
hash: Sha3_512,
|
||||
location: String,
|
||||
}
|
||||
|
||||
impl Package {
|
||||
fn get_name(&self) -> String {
|
||||
self.name.to_string()
|
||||
}
|
||||
|
||||
fn get_publisher_name(&self) -> String {
|
||||
self.publisher.get_name()
|
||||
}
|
||||
|
||||
fn get_version(&self) -> String {
|
||||
self.version.to_string()
|
||||
}
|
||||
|
||||
fn get_size(&self) -> u64 {
|
||||
self.size
|
||||
}
|
||||
|
||||
fn get_hash(&self) -> String {
|
||||
self.hash.to_string()
|
||||
}
|
||||
|
||||
fn get_publish_date_time(&self) -> String {
|
||||
self.publish_date_time.to_string()
|
||||
}
|
||||
|
||||
fn get_last_update_date_time(&self) -> String {
|
||||
self.last_update_date_time.to_string()
|
||||
}
|
||||
|
||||
fn get_location(&self) -> String {
|
||||
self.location.to_string()
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) struct Version {
|
||||
first: u8,
|
||||
second: u8,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue