Improve type::thing() function
When running type::thing() with a record id the function now returns the correct record. For example type::thing("test", test:id) now returns the record test:id.
This commit is contained in:
parent
835018d5f4
commit
374644b9bd
1 changed files with 12 additions and 4 deletions
|
@ -102,8 +102,16 @@ pub fn table(_: &Runtime, mut args: Vec<Value>) -> Result<Value, Error> {
|
|||
}
|
||||
|
||||
pub fn thing(_: &Runtime, mut args: Vec<Value>) -> Result<Value, Error> {
|
||||
Ok(Value::Thing(Thing {
|
||||
tb: args.remove(0).as_strand().value,
|
||||
id: args.remove(0).as_strand().value,
|
||||
}))
|
||||
match args.remove(0) {
|
||||
tb => match args.remove(0) {
|
||||
Value::Thing(id) => Ok(Value::Thing(Thing {
|
||||
tb: tb.as_strand().value,
|
||||
id: id.id,
|
||||
})),
|
||||
id => Ok(Value::Thing(Thing {
|
||||
tb: tb.as_strand().value,
|
||||
id: id.as_strand().value,
|
||||
})),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue