tmplutils

package
v0.15.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 29, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractNetmaskFromCIDR

func ExtractNetmaskFromCIDR(cidr string) string

ExtractNetmaskFromCIDR extracts the netmask from the CIDR notation.

func HasExtension

func HasExtension(data any, field string) bool

HasExtensions check whether data is a struct and has the specified 'field', followed by a check if the 'field' has a value.

func LoadTemplate

func LoadTemplate(tplFile string) (*template.Template, error)

LoadTemplate creates template instance with auxiliary functions from specified template.

func SanitizeStringForResourceName

func SanitizeStringForResourceName(s string) string

Types

type Templates

type Templates struct {
	// output directory
	//
	// MUST be relative to base directory, i.e. services/terraformer/etc
	Directory string
}

func (Templates) Generate

func (t Templates) Generate(tpl *template.Template, outputFile string, d interface{}) error

creates a file from template and saves it to the directory specified in Templates the directory MUST be relative to base directory, i.e. services/terraformer/templates

func (Templates) GenerateToString

func (t Templates) GenerateToString(tpl *template.Template, d interface{}) (string, error)

creates a file from template and returns it as a string variable returns error if not successful, generated template as a string and nil otherwise

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL