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")]
#[format(Named)]
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]
None,
Null,
@ -120,11 +127,17 @@ pub enum Value {
Object(Object),
Geometry(Geometry),
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),
Idiom(Idiom),
Table(Table),
Thing(Thing),
Model(Model),
Regex(Regex),
Block(Box<Block>),