Sprig Functions
Sprig functions are provided by the jhelm-gotemplate-sprig module.
They are auto-discovered via ServiceLoader when the module is on the classpath (priority 100).
1. Categories
1.1. Strings
| Function | Description |
|---|---|
|
Whitespace and prefix/suffix trimming |
|
Case conversion |
|
String manipulation |
|
Quoting and concatenation |
|
Indentation (nindent prepends a newline) |
|
Naming convention conversion |
|
Split/join/replace operations |
|
Regular expressions (with |
|
String predicates |
|
Additional string utilities |
1.2. Collections
| Function | Description |
|---|---|
|
Create new lists |
|
Access list elements |
|
Extend lists |
|
List transformations |
|
List predicates |
|
Create a new map from key-value pairs |
|
Modify maps |
|
Map access |
|
Map introspection |
|
Deep map merging |
|
Map filtering |
|
Deep nested map access |
|
List slicing (Sprig’s |
1.3. Logic
| Function | Description |
|---|---|
|
Returns the first non-empty value |
|
Returns true if value is empty/zero/nil |
|
Returns first non-empty argument |
|
|
|
Unconditionally fails template execution with message |
|
Validates value is present and non-empty (actually a Helm function, see Helm Functions) |
1.4. Math
| Function | Description |
|---|---|
|
Basic arithmetic |
|
Rounding |
|
Min/max selection |
|
Numeric type conversion |
1.5. Encoding
| Function | Description |
|---|---|
|
Base64 encoding/decoding |
|
Base32 encoding/decoding |
|
Hash functions |
1.6. Crypto
| Function | Description |
|---|---|
|
Generate UUID v4 |
|
Random string generation |
|
BCrypt password hash (Apache htpasswd format) |
|
AES encryption/decryption |
|
Generate RSA/ECDSA private key |
|
Generate self-signed CA certificate |
|
Generate certificates |
|
Master Password algorithm |
1.7. Date
| Function | Description |
|---|---|
|
Current time |
|
Format date to string |
|
Add duration to date |
|
Convert to Unix timestamp |
|
Parse string to date |
|
Format for HTML date input |
1.8. Reflection
| Function | Description |
|---|---|
|
Get Java type/kind name |
|
Check type/kind |
|
Deep equality comparison |
|
Deep copy of value |