icydb_schema/node/
primary_key.rs1use crate::prelude::*;
2
3#[derive(Clone, Debug, Serialize)]
10pub struct PrimaryKey {
11 field: &'static str,
12
13 #[serde(default)]
14 source: PrimaryKeySource,
15}
16
17impl PrimaryKey {
18 #[must_use]
20 pub const fn new(field: &'static str, source: PrimaryKeySource) -> Self {
21 Self { field, source }
22 }
23
24 #[must_use]
26 pub const fn field(&self) -> &'static str {
27 self.field
28 }
29
30 #[must_use]
32 pub const fn source(&self) -> PrimaryKeySource {
33 self.source
34 }
35}
36
37#[derive(Clone, Copy, Debug, Default, Eq, PartialEq, Serialize)]
44pub enum PrimaryKeySource {
45 #[default]
46 Internal,
47
48 External,
49}