Documentation
¶
Index ¶
- func Camelize(term string, firstLetter string) string
- func Concat[T any](S1 []T, S2 []T) (ret []T)
- func Diff(S1, S2 []string) []string
- func FirstSentence(text string) string
- func Format2Regex(format string) string
- func Plural(source string) string
- func Reject[T any](S []T, test func(T) bool) (ret []T)
- func Select[T any](S []T, test func(T) bool) (ret []T)
- func SpaceSeparated(source string) string
- func SpaceSeparatedTitle(source string) string
- func TemplateFunctions(templateFs fs.FS) template.FuncMap
- func Underscore(source string) string
- type ReadDirReadFileFS
- type YamlValidator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FirstSentence ¶
Returns all the characters up until the period (.) or returns text unchanged if there is no period.
func Format2Regex ¶
Transforms a format string with field markers to a regex string with capture groups. For instance,
projects/{{project}}/global/networks/{{name}}
is transformed to
projects/(?P<project>[^/]+)/global/networks/(?P<name>[^/]+)
Values marked with % are URL-encoded, and will match any number of /'s. Note: ?P indicates a Python-compatible named capture group. Named groups aren't common in JS-based regex flavours, but are in Perl-based ones
func Reject ¶
Returns a new slice containing all of the elements for which the test function returns false in the original slice
func Select ¶
Returns a new slice containing all of the elements for which the test function returns true in the original slice
func SpaceSeparated ¶
Converts from PascalCase to Space Separated For example, converts "AccessApproval" to "Access approval"
func SpaceSeparatedTitle ¶
Converts a string to space-separated capitalized words
func Underscore ¶
// Helper class to process and mutate strings. class StringUtils Converts string from camel case to underscore
Types ¶
type ReadDirReadFileFS ¶
type ReadDirReadFileFS interface {
fs.ReadDirFS
fs.ReadFileFS
}
internal interface supporting ReadDirFS and ReadFileFS
Most sensible FS implementations support these, as an example both `embed.FS` and `os.DirFS(...)` implement these.
func NewOverlayFS ¶
func NewOverlayFS(overlayDirectory, baseDirectory string) (ReadDirReadFileFS, error)
NewOverlayFS create an overlay FS from two directories. overlayDirectory may be empty to
type YamlValidator ¶
type YamlValidator struct{}
A helper class to validate contents coming from YAML files.
func (*YamlValidator) Parse ¶
func (v *YamlValidator) Parse(content []byte, obj interface{}, yamlPath string)