Skip to main content

reifydb_core/value/column/push/
uuid.rs

1// SPDX-License-Identifier: AGPL-3.0-or-later
2// Copyright (c) 2025 ReifyDB
3
4use reifydb_type::{
5	storage::DataBitVec,
6	value::{
7		identity::IdentityId,
8		uuid::{Uuid4, Uuid7},
9	},
10};
11
12use crate::value::column::{data::ColumnData, push::Push};
13
14impl Push<Uuid4> for ColumnData {
15	fn push(&mut self, value: Uuid4) {
16		match self {
17			ColumnData::Uuid4(container) => container.push(value),
18			ColumnData::Option {
19				inner,
20				bitvec,
21			} => {
22				inner.push(value);
23				DataBitVec::push(bitvec, true);
24			}
25			other => {
26				panic!(
27					"called `push::<Uuid4>()` on incompatible EngineColumnData::{:?}",
28					other.get_type()
29				);
30			}
31		}
32	}
33}
34
35impl Push<Uuid7> for ColumnData {
36	fn push(&mut self, value: Uuid7) {
37		match self {
38			ColumnData::Uuid7(container) => container.push(value),
39			ColumnData::Option {
40				inner,
41				bitvec,
42			} => {
43				inner.push(value);
44				DataBitVec::push(bitvec, true);
45			}
46			other => {
47				panic!(
48					"called `push::<Uuid7>()` on incompatible EngineColumnData::{:?}",
49					other.get_type()
50				);
51			}
52		}
53	}
54}
55
56impl Push<IdentityId> for ColumnData {
57	fn push(&mut self, value: IdentityId) {
58		match self {
59			ColumnData::IdentityId(container) => container.push(value),
60			ColumnData::Option {
61				inner,
62				bitvec,
63			} => {
64				inner.push(value);
65				DataBitVec::push(bitvec, true);
66			}
67			other => {
68				panic!(
69					"called `push::<IdentityId>()` on incompatible EngineColumnData::{:?}",
70					other.get_type()
71				);
72			}
73		}
74	}
75}