templates

package
v0.1.22 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2024 License: MIT Imports: 11 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyTemplate

func ApplyTemplate(t string, data any) (string, error)

ApplyTemplate takes a YAML template as []byte, populates it using data, and returns the result as a string.

func ApplyTemplateFrom added in v0.0.26

func ApplyTemplateFrom(ctx context.Context, fs shared.FileSystem, f string, obj any) (string, error)

func Copy added in v0.0.13

func Copy(ctx context.Context, fs shared.FileSystem, f string, destination string) error

func CopyAndApply

func CopyAndApply(ctx context.Context, fs shared.FileSystem, root string, destination string, obj any) error

func CopyAndApplyTemplate

func CopyAndApplyTemplate(ctx context.Context, fs shared.FileSystem, f string, destination string, obj any) error

func CopyAndReplace

func CopyAndReplace(ctx context.Context, fs shared.FileSystem, f string, destination string, replacer Replacer) error

func CopyAndVisit

func CopyAndVisit(ctx context.Context, fs shared.FileSystem, root string, destination string, visitor FileVisitor) error

func Walk

func Walk(ctx context.Context, fs shared.FileSystem, root string, pathSelect shared.PathSelect, files *[]string, dirs *[]string) error

Types

type AlreadyExistError

type AlreadyExistError struct {
	// contains filtered or unexported fields
}

func (AlreadyExistError) Error

func (a AlreadyExistError) Error() string

type FileVisitor

type FileVisitor interface {
	shared.PathSelect
	Apply(ctx context.Context, from string, to string) error
}

type Replacer

type Replacer interface {
	Do([]byte) ([]byte, error)
}

type ServiceReplacer

type ServiceReplacer struct {
	// contains filtered or unexported fields
}

func NewServiceReplacer

func NewServiceReplacer(gen *generation.Service) *ServiceReplacer

func (*ServiceReplacer) Do

func (r *ServiceReplacer) Do(content []byte) ([]byte, error)

type Templator added in v0.1.18

type Templator struct {
	PathSelect shared.PathSelect
	Override   shared.Override
}

func (*Templator) CopyAndApply added in v0.1.18

func (t *Templator) CopyAndApply(ctx context.Context, fs shared.FileSystem, root string, destination string, obj any) error

func (*Templator) Keep added in v0.1.20

func (t *Templator) Keep(name string) bool

func (*Templator) Replace added in v0.1.18

func (t *Templator) Replace(p string) bool

Jump to

Keyboard shortcuts

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