Skip to main content

reifydb_core/value/column/push/
uuid.rs

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