Help us shape the future of Go! Take the 2026 Go Developer Survey

render

package
v3.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const EventNamesDir = "events"

EventNamesDir is the directory, relative to the bindings root, that holds the module exporting typed event names.

Variables

View Source
var Newline string

Functions

This section is empty.

Types

type Renderer

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

Renderer holds the template set for a given configuration. It provides methods for rendering various output modules.

func NewRenderer

func NewRenderer(collector *collect.Collector, options *flags.GenerateBindingsOptions) *Renderer

NewRenderer initialises a code renderer for the given configuration and data collector.

func (*Renderer) EventCreate

func (renderer *Renderer) EventCreate(w io.Writer, events *collect.EventMap) error

EventCreate renders the given event map to w as event data creation code.

func (*Renderer) EventCreateFile

func (renderer *Renderer) EventCreateFile() string

EventCreateFile returns the standard name of the event data creation file with the appropriate extension.

func (*Renderer) EventData

func (renderer *Renderer) EventData(w io.Writer, events *collect.EventMap) error

EventData renders the given event map to w as an event data table.

func (*Renderer) EventDataFile

func (renderer *Renderer) EventDataFile() string

EventDataFile returns the standard name of the event data definitions file with the appropriate extension.

func (*Renderer) EventNames

func (renderer *Renderer) EventNames(w io.Writer, events *collect.EventMap) error

EventNames renders the given event map to w as a module exporting one constant per registered event, so that events can be referred to by (typed) identifier instead of by string literal.

func (*Renderer) EventNamesFile

func (renderer *Renderer) EventNamesFile() string

EventNamesFile returns the path, relative to the bindings root, of the module that exports one named constant for each registered event.

func (*Renderer) Index

func (renderer *Renderer) Index(w io.Writer, index *collect.PackageIndex) error

Index renders the given package index to w.

func (*Renderer) IndexFile

func (renderer *Renderer) IndexFile() string

IndexFile returns the standard name of a package index file with the appropriate extension.

func (*Renderer) Models

func (renderer *Renderer) Models(w io.Writer, imports *collect.ImportMap, models []*collect.ModelInfo) error

Models renders type definitions for the given list of models.

func (*Renderer) ModelsFile

func (renderer *Renderer) ModelsFile() string

ModelsFile returns the standard name of a models file with the appropriate extension.

func (*Renderer) Service

func (renderer *Renderer) Service(w io.Writer, info *collect.ServiceInfo) error

Service renders binding code for the given service type to w.

func (*Renderer) ServiceFile

func (renderer *Renderer) ServiceFile(name string) string

ServiceFile returns the standard name of a service file for the given struct name, with the appropriate extension.

Jump to

Keyboard shortcuts

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