aboutsummaryrefslogtreecommitdiffstats
path: root/log_db/tests
diff options
context:
space:
mode:
authorJan Tuomi <jan@jantuomi.fi>2025-02-21 14:16:24 +0200
committerJan Tuomi <jan@jantuomi.fi>2025-02-21 14:16:24 +0200
commitbea37e2834a5265035b960277ff27e5f8d74d079 (patch)
tree9a48f8d0fc926e9fe5dcc232dee7ba287cfac126 /log_db/tests
parentcdc78ce436459047b06163f98fc661df9f2026f4 (diff)
Start working in new schema logic to core
Diffstat (limited to 'log_db/tests')
-rw-r--r--log_db/tests/integration.rs35
1 files changed, 34 insertions, 1 deletions
diff --git a/log_db/tests/integration.rs b/log_db/tests/integration.rs
index 3d71279..af12fb4 100644
--- a/log_db/tests/integration.rs
+++ b/log_db/tests/integration.rs
@@ -36,6 +36,22 @@ enum Field {
Data,
}
+impl AsRef<str> for Field {
+ fn as_ref(&self) -> &str {
+ match self {
+ Field::Id => "id",
+ Field::Name => "name",
+ Field::Data => "data",
+ }
+ }
+}
+
+impl Into<String> for Field {
+ fn into(self) -> String {
+ self.as_ref().to_owned()
+ }
+}
+
#[derive(Debug)]
struct Inst {
pub id: i64,
@@ -610,7 +626,7 @@ fn test_batch_find_by() {
}
let batch: Vec<Value> = (2..5).map(Value::Int).collect();
- let result = db.batch_find_by(&Field::Id, &batch).unwrap();
+ let result = db.batch_find_by(Field::Id, &batch).unwrap();
assert_eq!(result.len(), batch.len());
assert_eq!(
@@ -707,6 +723,23 @@ enum FieldWithNewNullableField {
MaybeStr,
}
+impl AsRef<str> for FieldWithNewNullableField {
+ fn as_ref(&self) -> &str {
+ match self {
+ FieldWithNewNullableField::Id => "id",
+ FieldWithNewNullableField::Name => "name",
+ FieldWithNewNullableField::Data => "data",
+ FieldWithNewNullableField::MaybeStr => "maybe_str",
+ }
+ }
+}
+
+impl Into<String> for FieldWithNewNullableField {
+ fn into(self) -> String {
+ self.as_ref().to_owned()
+ }
+}
+
struct InstWithNewNullableField {
pub id: i64,
pub name: Option<String>,