Rename function for simplicity

This commit is contained in:
Tobie Morgan Hitchcock 2022-09-19 12:28:41 +01:00
parent 70970862f4
commit d6b544771f
3 changed files with 4 additions and 4 deletions

View file

@ -842,14 +842,14 @@ impl Value {
// -----------------------------------
/// Fetch the record id if there is one
pub fn rid(self) -> Option<Thing> {
pub fn record(self) -> Option<Thing> {
match self {
Value::Object(mut v) => match v.remove("id") {
Some(Value::Thing(v)) => Some(v),
_ => None,
},
Value::Array(mut v) => match v.len() {
1 => v.remove(0).rid(),
1 => v.remove(0).record(),
_ => None,
},
Value::Thing(v) => Some(v),

View file

@ -123,7 +123,7 @@ pub async fn sc(
// Compute the value with the params
match kvs.compute(val, &sess, vars, opt.strict).await {
// The signin value succeeded
Ok(val) => match val.rid() {
Ok(val) => match val.record() {
// There is a record returned
Some(rid) => {
// Create the authentication key

View file

@ -58,7 +58,7 @@ pub async fn sc(
// Compute the value with the params
match kvs.compute(val, &sess, vars, opt.strict).await {
// The signin value succeeded
Ok(val) => match val.rid() {
Ok(val) => match val.record() {
// There is a record returned
Some(rid) => {
// Create the authentication key