aboutsummaryrefslogtreecommitdiffstats
path: root/src/common.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/common.rs')
-rw-r--r--src/common.rs42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/common.rs b/src/common.rs
index 2f0f942..c2af766 100644
--- a/src/common.rs
+++ b/src/common.rs
@@ -107,6 +107,48 @@ pub enum RecordFieldType {
}
#[derive(Debug, Clone)]
+pub struct RecordField {
+ pub field_type: RecordFieldType,
+ pub nullable: bool,
+}
+
+impl RecordField {
+ pub fn int() -> Self {
+ RecordField {
+ field_type: RecordFieldType::Int,
+ nullable: false,
+ }
+ }
+
+ pub fn float() -> Self {
+ RecordField {
+ field_type: RecordFieldType::Float,
+ nullable: false,
+ }
+ }
+
+ pub fn string() -> Self {
+ RecordField {
+ field_type: RecordFieldType::String,
+ nullable: false,
+ }
+ }
+
+ pub fn bytes() -> Self {
+ RecordField {
+ field_type: RecordFieldType::Bytes,
+ nullable: false,
+ }
+ }
+
+ pub fn nullable(&mut self) -> Self {
+ let mut new = self.clone();
+ new.nullable = true;
+ new
+ }
+}
+
+#[derive(Debug, Clone)]
pub enum RecordValue {
Null,
Int(i64),