Documentation
¶
Index ¶
- Constants
- Variables
- func Base64Decode(text string) (string, error)
- func Base64Encode(text string) string
- func Dedent(text string) string
- func Indent(text string, numberOfSpaces int) string
- func IndentTab(text string, numberOfTabs int) string
- func MultilineString(text string) string
- func ParseTemplate(templateText string, data any) string
- func SlogNoLineBreakAttr() slog.Attr
- func ToKubernetesIdentifier(name string) string
Examples ¶
Constants ¶
View Source
const (
NoLineBreakAttrKey = "no_line_break"
)
Variables ¶
View Source
var (
AppVersion = "0.0.0"
)
Functions ¶
func Base64Decode ¶ added in v0.2.0
func Base64Encode ¶ added in v0.2.0
func Dedent ¶ added in v0.2.0
Example ¶
s := `
Lorem ipsum dolor sit amet,
consectetur adipiscing elit.
Curabitur justo tellus, facilisis nec efficitur dictum,
fermentum vitae ligula. Sed eu convallis sapien.`
fmt.Println(Dedent(s))
fmt.Println("-------------")
fmt.Println(s)
Output: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur justo tellus, facilisis nec efficitur dictum, fermentum vitae ligula. Sed eu convallis sapien. ------------- Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur justo tellus, facilisis nec efficitur dictum, fermentum vitae ligula. Sed eu convallis sapien.
func Indent ¶ added in v0.2.0
Indents the each line with given number of spaces except the first line.
Example ¶
indented := Indent(`line1 line2 line3`, 2) fmt.Println(indented)
Output: line1 line2 line3
func IndentTab ¶ added in v0.2.0
Indents the each line with given number of tabs except the first line.
func MultilineString ¶ added in v0.2.0
Dedents the data using Dedent so that the multiline strings with indentation are handled properly. Trims the spaces after dedent.
Example ¶
indented := MultilineString(` line1 line2 line3`) fmt.Println(indented)
Output: line1 line2 line3
func ParseTemplate ¶ added in v0.2.0
Parses a template as a string by calling MultilineString on template text beforehand. Panics if template is invalid.
func SlogNoLineBreakAttr ¶
func ToKubernetesIdentifier ¶ added in v0.2.0
Converts a string to a valid Kubernetes identifier by replacing invalid characters.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.