zino_core/model/
reference.rs

1use serde::Serialize;
2
3/// A model reference for a column.
4#[derive(Debug, Clone, Serialize)]
5pub struct Reference<'a> {
6    /// Reference name, i.e. the table name.
7    name: &'a str,
8    /// Column name.
9    column_name: &'a str,
10}
11
12impl<'a> Reference<'a> {
13    /// Creates a new instance.
14    #[inline]
15    pub fn new(name: &'a str, column_name: &'a str) -> Self {
16        Self { name, column_name }
17    }
18
19    /// Returns the reference name.
20    #[inline]
21    pub fn name(&self) -> &'a str {
22        self.name
23    }
24
25    /// Returns the referenced column name.
26    #[inline]
27    pub fn column_name(&self) -> &'a str {
28        self.column_name
29    }
30}