rendering

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package rendering turns structured views into source files on disk.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Artifacts

type Artifacts map[string]View

Artifacts maps output file names to their corresponding View.

type Fileset

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

Fileset represents a set of Artifacts that can be written to the file system.

func NewFileset

func NewFileset(a Artifacts) Fileset

NewFileset constructs a Fileset from the provided Artifacts.

func (Fileset) Emit

func (f Fileset) Emit(path string) error

Emit writes all artifacts to path, creating it and any missing parents if they do not exist. Returns an error if the directory cannot be created or any artifact fails to render.

type Meta added in v0.1.1

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

Meta represents the binary metadata, adapted for use in templates.

func NewMeta added in v0.1.1

func NewMeta(m meta.Meta) Meta

NewMeta creates a Meta from the given meta.Meta.

func (Meta) Release added in v0.1.1

func (m Meta) Release() Release

Release returns the release metadata.

type Release added in v0.1.1

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

Release represents the release metadata of the tool, adapted for use in templates.

func NewRelease added in v0.1.1

func NewRelease(r meta.Release) Release

NewRelease creates a Release from the given meta.Release.

func (Release) Version added in v0.1.1

func (r Release) Version() string

Version returns the semantic version of the tool (e.g., "v0.1.0").

type Snapshot added in v0.1.1

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

Snapshot represents the generation moment metadata, adapted for use in templates.

func NewSnapshot added in v0.1.1

func NewSnapshot(s meta.Snapshot) Snapshot

NewSnapshot creates a Snapshot from the given meta.Snapshot.

func (Snapshot) Date added in v0.1.1

func (s Snapshot) Date() string

Date returns the generation date formatted as "YYYY-MM-DD".

func (Snapshot) Meta added in v0.1.1

func (s Snapshot) Meta() Meta

Meta returns the binary metadata.

type TemplateView

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

TemplateView represents a View that renders a named text/template with structured data.

func NewTemplateView

func NewTemplateView(t *template.Template, name string, data any) TemplateView

NewTemplateView constructs a TemplateView for template name in t with the given data.

func (TemplateView) Render

func (v TemplateView) Render(w io.Writer) error

Render implements View.

type View

type View interface {
	// Render writes the generated content to w. Returns an error if writing fails.
	Render(w io.Writer) error
}

View represents a unit of generated output that can be written to an io.Writer.

Directories

Path Synopsis
Package golang provides the necessary templates and execution context to generate Go source code from the parsed Telegram Bot API specification.
Package golang provides the necessary templates and execution context to generate Go source code from the parsed Telegram Bot API specification.

Jump to

Keyboard shortcuts

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