Add detailed code comments for Value enum variants (#1938)

This commit is contained in:
Tobie Morgan Hitchcock 2023-05-06 00:53:26 +01:00 committed by GitHub
parent 591634e049
commit e725b3e8e6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -107,6 +107,13 @@ pub fn whats(i: &str) -> IResult<&str, Values> {
#[serde(rename = "$surrealdb::private::sql::Value")] #[serde(rename = "$surrealdb::private::sql::Value")]
#[format(Named)] #[format(Named)]
pub enum Value { pub enum Value {
// These value types are simple values which
// can be used in query responses sent to
// the client. They typically do not need to
// be computed, unless an un-computed value
// is present inside an Array or Object type.
// These types can also be used within indexes
// and sort according to their order below.
#[default] #[default]
None, None,
Null, Null,
@ -120,11 +127,17 @@ pub enum Value {
Object(Object), Object(Object),
Geometry(Geometry), Geometry(Geometry),
Bytes(Bytes), Bytes(Bytes),
// --- Thing(Thing),
// These Value types are un-computed values
// and are not used in query responses sent
// to the client. These types need to be
// computed, in order to convert them into
// one of the simple types listed above.
// These types are first computed into a
// simple type before being used in indexes.
Param(Param), Param(Param),
Idiom(Idiom), Idiom(Idiom),
Table(Table), Table(Table),
Thing(Thing),
Model(Model), Model(Model),
Regex(Regex), Regex(Regex),
Block(Box<Block>), Block(Box<Block>),