Skip to content

Commit

Permalink
docs: Update template_functions.md (#12841)
Browse files Browse the repository at this point in the history
  • Loading branch information
doanbutar authored May 2, 2024
1 parent 48bbf98 commit ed84b23
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions docs/sources/query/template_functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -303,26 +303,26 @@ Example:

Use this function to test to see if one string is contained inside of another.

Signature: `contains(s string, src string) bool`
Signature: `contains(src string, s string,) bool`

Examples:

```template
{{ if contains .err "ErrTimeout" }} timeout {{end}}
{{ if contains "ErrTimeout" .err }} timeout {{end}}
{{ if contains "he" "hello" }} yes {{end}}
```

## eq

Use this function to test to see if one string has exact matching inside of another.

Signature: `eq(s string, src string) bool`
Signature: `eq(src string, s string) bool`

Examples:

```template
{{ if eq .err "ErrTimeout" }} timeout {{end}}
{{ if eq "he" "hello" }} yes {{end}}
{{ if eq "ErrTimeout" .err}} timeout {{end}}
{{ if eq "hello" "hello" }} yes {{end}}
```

## hasPrefix and hasSuffix
Expand Down

0 comments on commit ed84b23

Please sign in to comment.