diff options
Diffstat (limited to 'log_db/src/record.rs')
| -rw-r--r-- | log_db/src/record.rs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/log_db/src/record.rs b/log_db/src/record.rs index 1b882ed..8d518f0 100644 --- a/log_db/src/record.rs +++ b/log_db/src/record.rs @@ -104,8 +104,15 @@ impl Record { pub trait Recordable { /// The field type of the data structure implementing the `Recordable` trait. type Field: Eq + Clone + Debug; - /// Define the schema of the data structure implementing the `Recordable` trait. + /// Define the schema of the instance implementing the `Recordable` trait. fn schema() -> Vec<(Self::Field, ValueType)>; + /// Define the primary key of the instance implementing the `Recordable` trait. + fn primary_key() -> Self::Field; + /// Define the secondary keys of the instance implementing the `Recordable` trait. + fn secondary_keys() -> Vec<Self::Field> { + Vec::new() + } + /// Convert the data structure implementing the `Recordable` trait into a vector of database values. fn into_record(self) -> Vec<Value>; /// Convert a vector of database values into the data structure implementing the `Recordable` trait. |
