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