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::uuid::{Uuid4, Uuid7},
7};
8
9use crate::value::column::{data::ColumnData, push::Push};
10
11impl Push<Uuid4> for ColumnData {
12	fn push(&mut self, value: Uuid4) {
13		match self {
14			ColumnData::Uuid4(container) => container.push(value),
15			ColumnData::Option {
16				inner,
17				bitvec,
18			} => {
19				inner.push(value);
20				DataBitVec::push(bitvec, true);
21			}
22			other => {
23				panic!(
24					"called `push::<Uuid4>()` on incompatible EngineColumnData::{:?}",
25					other.get_type()
26				);
27			}
28		}
29	}
30}
31
32impl Push<Uuid7> for ColumnData {
33	fn push(&mut self, value: Uuid7) {
34		match self {
35			ColumnData::Uuid7(container) => container.push(value),
36			ColumnData::Option {
37				inner,
38				bitvec,
39			} => {
40				inner.push(value);
41				DataBitVec::push(bitvec, true);
42			}
43			other => {
44				panic!(
45					"called `push::<Uuid7>()` on incompatible EngineColumnData::{:?}",
46					other.get_type()
47				);
48			}
49		}
50	}
51}