"timestamp" expression
This commit is contained in:
parent
0837606ca7
commit
733037f41b
|
@ -74,6 +74,7 @@ pub enum Expr {
|
||||||
template: AnyValue,
|
template: AnyValue,
|
||||||
},
|
},
|
||||||
Dataspace,
|
Dataspace,
|
||||||
|
Timestamp,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
|
@ -426,6 +427,7 @@ impl Env {
|
||||||
match e {
|
match e {
|
||||||
Expr::Template { template } => self.instantiate_value(template),
|
Expr::Template { template } => self.instantiate_value(template),
|
||||||
Expr::Dataspace => Ok(AnyValue::domain(Cap::new(&t.create(Dataspace::new())))),
|
Expr::Dataspace => Ok(AnyValue::domain(Cap::new(&t.create(Dataspace::new())))),
|
||||||
|
Expr::Timestamp => Ok(AnyValue::new(chrono::Utc::now().to_rfc3339())),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -763,6 +765,11 @@ impl<'t> Parser<'t> {
|
||||||
return Some(Expr::Dataspace);
|
return Some(Expr::Dataspace);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if self.peek() == &Value::symbol("timestamp") {
|
||||||
|
self.drop();
|
||||||
|
return Some(Expr::Timestamp);
|
||||||
|
}
|
||||||
|
|
||||||
return Some(Expr::Template{ template: self.shift() });
|
return Some(Expr::Template{ template: self.shift() });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue