generator

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractEmbeddedFS

func ExtractEmbeddedFS(filesystem fs.FS, destDir string) error

ExtractEmbeddedFS extracts an embedded filesystem to a directory

func Generate

func Generate(
	templateLoader TemplateLoader,
	templateData *TemplateData,
	outputDir string,
) error

Generate generates all code files from templates by scanning the template directory

func GetTemplateFuncMap

func GetTemplateFuncMap() template.FuncMap

GetTemplateFuncMap Helper functions for templates

Types

type TemplateData

type TemplateData struct {
	VipsVersion string
	Operations  []introspection.Operation
	EnumTypes   []introspection.EnumTypeInfo
	ImageTypes  []introspection.ImageTypeInfo
}

TemplateData holds all data needed by any template

func NewTemplateData

func NewTemplateData(
	vipsVersion string,
	operations []introspection.Operation,
	enumTypes []introspection.EnumTypeInfo,
	imageTypes []introspection.ImageTypeInfo,
) *TemplateData

NewTemplateData creates a new TemplateData structure with all needed information

type TemplateLoader

type TemplateLoader interface {
	// LoadTemplate loads a template by name
	LoadTemplate(name string) (*template.Template, error)

	// ListFiles returns a list of all template files
	ListFiles() ([]string, error)

	// GenerateFile generates a file using a template and data
	GenerateFile(templateName, outputFile string, data interface{}) error
}

TemplateLoader is an interface for loading and generating files from templates

func NewFSTemplateLoader

func NewFSTemplateLoader(filesystem fs.FS, funcMap template.FuncMap) TemplateLoader

NewFSTemplateLoader creates a new template loader from any fs.FS implementation

func NewOSTemplateLoader

func NewOSTemplateLoader(rootDir string, funcMap template.FuncMap) (TemplateLoader, error)

NewOSTemplateLoader creates a template loader from the OS filesystem

Jump to

Keyboard shortcuts

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