Add concat function

This commit is contained in:
Svilen Markov 2025-03-29 13:20:53 +00:00
parent 26d68ba3fc
commit f15d7445bd
2 changed files with 4 additions and 0 deletions

View File

@ -345,6 +345,7 @@ The following helper functions provided by Glance are available:
- `sortByInt(key string, order string, arr []JSON): []JSON`: Sorts an array of JSON objects by an integer key in either ascending or descending order. - `sortByInt(key string, order string, arr []JSON): []JSON`: Sorts an array of JSON objects by an integer key in either ascending or descending order.
- `sortByFloat(key string, order string, arr []JSON): []JSON`: Sorts an array of JSON objects by a float key in either ascending or descending order. - `sortByFloat(key string, order string, arr []JSON): []JSON`: Sorts an array of JSON objects by a float key in either ascending or descending order.
- `sortByTime(key string, layout string, order string, arr []JSON): []JSON`: Sorts an array of JSON objects by a time key in either ascending or descending order. The format must be provided in Go's [date format](https://pkg.go.dev/time#pkg-constants). - `sortByTime(key string, layout string, order string, arr []JSON): []JSON`: Sorts an array of JSON objects by a time key in either ascending or descending order. The format must be provided in Go's [date format](https://pkg.go.dev/time#pkg-constants).
- `concat(strings ...string) string`: Concatenates multiple strings together.
The following helper functions provided by Go's `text/template` are available: The following helper functions provided by Go's `text/template` are available:

View File

@ -514,6 +514,9 @@ var customAPITemplateFuncs = func() template.FuncMap {
return results return results
}, },
"concat": func(items ...string) string {
return strings.Join(items, "")
},
} }
for key, value := range globalTemplateFunctions { for key, value := range globalTemplateFunctions {