Add a sql::Value::into_json()
method (#1963)
This commit is contained in:
parent
1140c36942
commit
f1ef3bfd21
1 changed files with 9 additions and 0 deletions
|
@ -53,6 +53,7 @@ use nom::multi::separated_list0;
|
||||||
use nom::multi::separated_list1;
|
use nom::multi::separated_list1;
|
||||||
use once_cell::sync::Lazy;
|
use once_cell::sync::Lazy;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
use serde_json::Value as Json;
|
||||||
use std::cmp::Ordering;
|
use std::cmp::Ordering;
|
||||||
use std::collections::BTreeMap;
|
use std::collections::BTreeMap;
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
@ -1020,6 +1021,14 @@ impl Value {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Converts a `surrealdb::sq::Value` into a `serde_json::Value`
|
||||||
|
///
|
||||||
|
/// This converts certain types like `Thing` into their simpler formats
|
||||||
|
/// instead of the format used internally by SurrealDB.
|
||||||
|
pub fn into_json(self) -> Json {
|
||||||
|
self.into()
|
||||||
|
}
|
||||||
|
|
||||||
// -----------------------------------
|
// -----------------------------------
|
||||||
// Simple conversion of value
|
// Simple conversion of value
|
||||||
// -----------------------------------
|
// -----------------------------------
|
||||||
|
|
Loading…
Reference in a new issue