Make is_null/is_not_null DSL functions include new JSON-null type

This commit is contained in:
John Kerl 2022-01-18 07:37:13 -05:00
parent eb7e29d207
commit 21e7ee999e
2 changed files with 4 additions and 4 deletions

View file

@ -194,10 +194,10 @@ func BIF_is_notarray(input1 *mlrval.Mlrval) *mlrval.Mlrval {
return mlrval.FromBool(!input1.IsArray())
}
func BIF_is_notnull(input1 *mlrval.Mlrval) *mlrval.Mlrval {
return mlrval.FromBool(!input1.IsAbsent() && !input1.IsVoid())
return mlrval.FromBool(!input1.IsAbsent() && !input1.IsVoid() && !input1.IsNull())
}
func BIF_is_null(input1 *mlrval.Mlrval) *mlrval.Mlrval {
return mlrval.FromBool(input1.IsAbsent() || input1.IsVoid())
return mlrval.FromBool(input1.IsAbsent() || input1.IsVoid() || input1.IsNull())
}
func BIF_is_numeric(input1 *mlrval.Mlrval) *mlrval.Mlrval {
return mlrval.FromBool(input1.IsInt() || input1.IsFloat())

View file

@ -1203,14 +1203,14 @@ strftime_local.`,
{
name: "is_not_null",
class: FUNC_CLASS_TYPING,
help: "False if argument is null (empty or absent), true otherwise.",
help: "False if argument is null (empty, absent, or JSON null), true otherwise.",
unaryFunc: bifs.BIF_is_notnull,
},
{
name: "is_null",
class: FUNC_CLASS_TYPING,
help: "True if argument is null (empty or absent), false otherwise.",
help: "True if argument is null (empty, absent, or JSON null), false otherwise.",
unaryFunc: bifs.BIF_is_null,
},