Skip to main content

reifydb_core/value/column/push/
uuid.rs

1// SPDX-License-Identifier: Apache-2.0
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::{buffer::ColumnBuffer, push::Push};
13
14impl Push<Uuid4> for ColumnBuffer {
15	fn push(&mut self, value: Uuid4) {
16		match self {
17			ColumnBuffer::Uuid4(container) => container.push(value),
18			ColumnBuffer::Option {
19				inner,
20				bitvec,
21			} => {
22				inner.push(value);
23				DataBitVec::push(bitvec, true);
24			}
25			other => {
26				panic!("called `push::<Uuid4>()` on incompatible ColumnBuffer::{:?}", other.get_type());
27			}
28		}
29	}
30}
31
32impl Push<Uuid7> for ColumnBuffer {
33	fn push(&mut self, value: Uuid7) {
34		match self {
35			ColumnBuffer::Uuid7(container) => container.push(value),
36			ColumnBuffer::Option {
37				inner,
38				bitvec,
39			} => {
40				inner.push(value);
41				DataBitVec::push(bitvec, true);
42			}
43			other => {
44				panic!("called `push::<Uuid7>()` on incompatible ColumnBuffer::{:?}", other.get_type());
45			}
46		}
47	}
48}
49
50impl Push<IdentityId> for ColumnBuffer {
51	fn push(&mut self, value: IdentityId) {
52		match self {
53			ColumnBuffer::IdentityId(container) => container.push(value),
54			ColumnBuffer::Option {
55				inner,
56				bitvec,
57			} => {
58				inner.push(value);
59				DataBitVec::push(bitvec, true);
60			}
61			other => {
62				panic!(
63					"called `push::<IdentityId>()` on incompatible ColumnBuffer::{:?}",
64					other.get_type()
65				);
66			}
67		}
68	}
69}