Skip to main content

parse_scalar

Function parse_scalar 

Source
pub fn parse_scalar(raw: &str) -> LinoValue
Expand description

Parse a filter value with the Links Notation scalar rules.

?done=true filters on the boolean, ?id=7 on the integer, and anything else stays a string.

ยงExamples

use lino_objects_codec::LinoValue;
use lino_rest_api::query::parse_scalar;

assert_eq!(parse_scalar("true"), LinoValue::Bool(true));
assert_eq!(parse_scalar("7"), LinoValue::Int(7));
assert_eq!(parse_scalar("seven"), LinoValue::String("seven".into()));