pub fn json_object_contains_key<'a, L>(
left: L,
path: &'a str,
key: &'a str,
) -> SQL<'a, SQLiteValue<'a>>where
L: ToSQL<'a, SQLiteValue<'a>>,Expand description
Builds a test that is true when the JSON object at path has the key
key.
The key is appended to the path ("$" and "" mean the root object),
and the result is checked with json_type(..) IS NOT NULL. key is not
quoted, so it must be a plain key name.
ยงExamples
let column = SQL::<SQLiteValue>::raw("metadata");
let condition = json_object_contains_key(column, "$", "theme");
assert_eq!(condition.sql(), "json_type( metadata , ? ) IS NOT NULL");