Show ENFORCED keyword in INFO statement (#4635)
This commit is contained in:
parent
9edb956386
commit
ba5c1436ff
3 changed files with 23 additions and 0 deletions
|
@ -203,6 +203,9 @@ impl Display for DefineTableStatement {
|
|||
kind.iter().map(|t| t.0.as_str()).collect::<Vec<_>>().join(" | ")
|
||||
)?;
|
||||
}
|
||||
if rel.enforced {
|
||||
write!(f, " ENFORCED")?;
|
||||
}
|
||||
}
|
||||
TableType::Any => {
|
||||
f.write_str(" ANY")?;
|
||||
|
|
|
@ -31,6 +31,9 @@ impl Display for TableType {
|
|||
if let Some(kind) = &rel.to {
|
||||
write!(f, " OUT {kind}")?;
|
||||
}
|
||||
if rel.enforced {
|
||||
write!(f, " ENFORCED")?;
|
||||
}
|
||||
}
|
||||
TableType::Any => {
|
||||
f.write_str(" ANY")?;
|
||||
|
@ -55,6 +58,7 @@ impl InfoStructure for TableType {
|
|||
tables.into_iter().map(|t| t.0).collect::<Vec<_>>().into(),
|
||||
"out".to_string(), if let Some(Kind::Record(tables)) = rel.to =>
|
||||
tables.into_iter().map(|t| t.0).collect::<Vec<_>>().into(),
|
||||
"enforced".to_string() => rel.enforced.into()
|
||||
}),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -265,6 +265,7 @@ async fn relate_enforced() -> Result<(), Error> {
|
|||
RELATE a:1->edge:1->a:2;
|
||||
CREATE a:1, a:2;
|
||||
RELATE a:1->edge:1->a:2;
|
||||
INFO FOR DB;
|
||||
";
|
||||
|
||||
let mut t = Test::new(sql).await?;
|
||||
|
@ -277,5 +278,20 @@ async fn relate_enforced() -> Result<(), Error> {
|
|||
//
|
||||
t.expect_val("[{ id: edge:1, in: a:1, out: a:2 }]")?;
|
||||
//
|
||||
let info = Value::parse(
|
||||
"{
|
||||
accesses: {},
|
||||
analyzers: {},
|
||||
functions: {},
|
||||
models: {},
|
||||
params: {},
|
||||
tables: {
|
||||
a: 'DEFINE TABLE a TYPE ANY SCHEMALESS PERMISSIONS NONE',
|
||||
edge: 'DEFINE TABLE edge TYPE RELATION ENFORCED SCHEMALESS PERMISSIONS NONE'
|
||||
},
|
||||
users: {}
|
||||
}",
|
||||
);
|
||||
t.expect_value(info)?;
|
||||
Ok(())
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue