From f8720c5a6e10a1a207e843f8c18f6347d968d3be Mon Sep 17 00:00:00 2001 From: Dennis Liu Date: Sat, 21 Oct 2023 22:32:50 +0800 Subject: [PATCH] Update doc for IsBool converter This commit updates the README.md file in the `pkg/ottl/ottlfuncs` directory to include documentation for the newly added IsBool converter. Detailed explanations, usage guidelines, and examples have been provided for the benefit of users. The documentation serves as a comprehensive guide for utilizing the IsBool converter within the OTTL ecosystem. --- pkg/ottl/ottlfuncs/README.md | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/pkg/ottl/ottlfuncs/README.md b/pkg/ottl/ottlfuncs/README.md index ac5d7dff851f..c975b6aad5b6 100644 --- a/pkg/ottl/ottlfuncs/README.md +++ b/pkg/ottl/ottlfuncs/README.md @@ -297,6 +297,7 @@ Available Converters: - [Double](#double) - [Duration](#duration) - [Int](#int) +- [IsBool](#isbool) - [IsMap](#ismap) - [IsMatch](#ismatch) - [IsString](#isstring) @@ -480,6 +481,32 @@ Examples: - `Int("2.0")` +### IsBool + +`IsBool(value)` + +The `IsBool` Converter evaluates whether the given `value` is a boolean or not. + +Specifically, it will return `true` if the provided `value` is one of the following: + +1. A Go's native `bool` type. +2. A `pcommon.ValueTypeBool`. + +Otherwise, it will return `false`. + +Examples: + +- `IsBool(false)` + + +- `IsBool(pcommon.NewValueBool(false))` + + +- `IsBool(42)` + + +- `IsBool(attributes["any key"])` + ### IsMap `IsMap(value)`