Skip to content

Commit

Permalink
Update doc for IsBool converter
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Dennis40816 committed Nov 12, 2023
1 parent 15db093 commit f8720c5
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions pkg/ottl/ottlfuncs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,7 @@ Available Converters:
- [Double](#double)
- [Duration](#duration)
- [Int](#int)
- [IsBool](#isbool)
- [IsMap](#ismap)
- [IsMatch](#ismatch)
- [IsString](#isstring)
Expand Down Expand Up @@ -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)`
Expand Down

0 comments on commit f8720c5

Please sign in to comment.