Documentation
¶
Index ¶
- Variables
- func NewTextRenderer(fs *filesystem.FileSystem, basePath string, data any) *templateTextRenderer
- func Required(warn string, val any) (any, error)
- func RequiredEnv(name string) (string, error)
- func ToYaml(v any) (string, error)
- type Context
- func (c *Context) CreateFuncMap() template.FuncMap
- func (c *Context) EnvExec(envs map[string]any, command string, args []any, inputs ...string) (string, error)
- func (c *Context) Exec(command string, args []any, inputs ...string) (string, error)
- func (c *Context) IsDir(filename string) (bool, error)
- func (c *Context) IsFile(filename string) (bool, error)
- func (c *Context) ReadDir(path string) ([]string, error)
- func (c *Context) ReadDirEntries(path string) ([]fs.DirEntry, error)
- func (c *Context) ReadFile(filename string) (string, error)
- func (c *Context) RenderTemplateToBuffer(s string, data ...any) (*bytes.Buffer, error)
- func (c *Context) SetBasePath(path string)
- func (c *Context) SetFileSystem(fs *filesystem.FileSystem)
- func (c *Context) Tpl(text string, data any) (string, error)
- type DisableInsecureFeaturesError
- type FileRenderer
- func (r *FileRenderer) RenderTemplateContentToBuffer(content []byte) (*bytes.Buffer, error)
- func (r *FileRenderer) RenderTemplateContentToString(content []byte) (string, error)
- func (r *FileRenderer) RenderTemplateFileToBuffer(file string) (*bytes.Buffer, error)
- func (r *FileRenderer) RenderToBytes(path string) ([]byte, error)
- type MockvalClient
- type MockvalClientMockRecorder
- type TextRenderer
- type Values
Constants ¶
This section is empty.
Variables ¶
var DisableInsecureFeaturesErr = DisableInsecureFeaturesError{envvar.DisableInsecureFeatures + " is active, insecure function calls are disabled"}
Functions ¶
func NewTextRenderer ¶
func NewTextRenderer(fs *filesystem.FileSystem, basePath string, data any) *templateTextRenderer
func RequiredEnv ¶
Types ¶
type Context ¶
type Context struct {
// contains filtered or unexported fields
}
func (*Context) CreateFuncMap ¶
CreateFuncMap creates a template.FuncMap for the Context struct. It combines the functions from sprig.TxtFuncMap() with the functions defined in the Context's createFuncMap() method. It also adds aliases for certain functions based on the aliases map. The resulting FuncMap is returned.
func (*Context) EnvExec ¶
func (c *Context) EnvExec(envs map[string]any, command string, args []any, inputs ...string) (string, error)
TODO: in the next major version, remove this function.
func (*Context) ReadDirEntries ¶ added in v0.145.3
func (*Context) RenderTemplateToBuffer ¶
RenderTemplateToBuffer renders the provided template string with the given data and returns the result as a *bytes.Buffer. The template string is parsed and executed using the Context's newTemplate method. If an error occurs during parsing or execution, it is returned along with the partially rendered template. The data parameter is optional and can be used to provide additional data for template rendering. If no data is provided, the template is rendered with an empty data context.
func (*Context) SetBasePath ¶
SetBasePath sets the base path for the template
func (*Context) SetFileSystem ¶ added in v0.145.4
func (c *Context) SetFileSystem(fs *filesystem.FileSystem)
type DisableInsecureFeaturesError ¶
type DisableInsecureFeaturesError struct {
// contains filtered or unexported fields
}
func (DisableInsecureFeaturesError) Error ¶
func (e DisableInsecureFeaturesError) Error() string
type FileRenderer ¶
func NewFileRenderer ¶
func NewFileRenderer(fs *filesystem.FileSystem, basePath string, data any) *FileRenderer
func NewFirstPassRenderer ¶
func NewFirstPassRenderer(basePath string, data any) *FileRenderer
func (*FileRenderer) RenderTemplateContentToBuffer ¶
func (r *FileRenderer) RenderTemplateContentToBuffer(content []byte) (*bytes.Buffer, error)
func (*FileRenderer) RenderTemplateContentToString ¶
func (r *FileRenderer) RenderTemplateContentToString(content []byte) (string, error)
func (*FileRenderer) RenderTemplateFileToBuffer ¶
func (r *FileRenderer) RenderTemplateFileToBuffer(file string) (*bytes.Buffer, error)
func (*FileRenderer) RenderToBytes ¶
func (r *FileRenderer) RenderToBytes(path string) ([]byte, error)
RenderToBytes loads the content of the file. If its extension is `gotmpl` it treats the content as a go template and renders it.
type MockvalClient ¶
type MockvalClient struct {
// contains filtered or unexported fields
}
MockvalClient is a mock of valClient interface
func NewMockvalClient ¶
func NewMockvalClient(ctrl *gomock.Controller) *MockvalClient
NewMockvalClient creates a new mock instance
func (*MockvalClient) EXPECT ¶
func (_m *MockvalClient) EXPECT() *MockvalClientMockRecorder
EXPECT returns an object that allows the caller to indicate expected use
type MockvalClientMockRecorder ¶
type MockvalClientMockRecorder struct {
// contains filtered or unexported fields
}
MockvalClientMockRecorder is the mock recorder for MockvalClient