Documentation
¶
Overview ¶
Package render: name-based execution for the construct emitters that render an ad-hoc view by template name rather than through a typed Render* function.
Package render turns a fully-resolved view (the IR built by the gather phase) into Go source. It does so through templates only: render makes no resolution decisions and imports no metadata or type-mapping packages — every value it needs is already present on the view. Its FuncMap holds pure formatting helpers, never type logic.
Index ¶
- func AsyncMethod(m view.AsyncMethod) ([]byte, error)
- func BoolNSErrorMethod(m view.BoolNSErrorMethod) ([]byte, error)
- func Constants(constants []view.Constant) ([]byte, error)
- func Enums(enums []view.Enum) ([]byte, error)
- func Execute(w io.Writer, name string, data any) error
- func Funcs(funcs []view.Func) ([]byte, error)
- func Method(m view.Method) ([]byte, error)
- func Must(w io.Writer, name string, data any)
- func Sentinels(sentinels []view.ErrorSentinel) ([]byte, error)
- func SliceMethod(m view.SliceMethod) ([]byte, error)
- func Structs(structs []view.Struct) ([]byte, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AsyncMethod ¶
func AsyncMethod(m view.AsyncMethod) ([]byte, error)
AsyncMethod renders a completion-handler method as a blocking, ctx-aware call.
func BoolNSErrorMethod ¶
func BoolNSErrorMethod(m view.BoolNSErrorMethod) ([]byte, error)
BoolNSErrorMethod renders a BOOL+NSError method as an error-returning method.
func Constants ¶
Constants renders the global-constant accessor functions for a package as a Go source fragment (before file assembly and gofmt).
func Enums ¶
Enums renders the concrete enum definitions for a package as a Go source fragment (a package body, before file assembly and gofmt). Each enum becomes a `type X <underlying>` declaration with a typed const block and a String method.
func Execute ¶
Execute runs a template by name against the single embedded template set shared with the typed renderers.
func Funcs ¶
Funcs renders the C-function wrappers for a package as a Go source fragment (before file assembly and gofmt).
func Method ¶
Method renders one Go method (or package-level function) — signature, doc, and body — from a resolved view.Method. The body comes from the method's Dispatch, so no Go syntax is assembled by string concatenation in the caller.
func Must ¶
Must is Execute, panicking on error — a template failure here is a codegen bug (bad view model or template). Output still flows through gofmt, which catches any malformed Go.
func Sentinels ¶
func Sentinels(sentinels []view.ErrorSentinel) ([]byte, error)
Sentinels renders the error-sentinel variable declarations for a package as a Go source fragment (before file assembly and gofmt).
func SliceMethod ¶
func SliceMethod(m view.SliceMethod) ([]byte, error)
SliceMethod renders an array-returning getter as a slice-returning method.
Types ¶
This section is empty.