Documentation
¶
Overview ¶
Package template provides template rendering for ctxweaver.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Template ¶
type Template struct {
// contains filtered or unexported fields
}
Template wraps a parsed template for statement generation.
type Vars ¶
type Vars struct {
// Ctx is the expression to access context.Context (e.g., "ctx", "c.Request().Context()")
Ctx string
// CtxVar is the name of the context parameter variable (e.g., "ctx", "c")
CtxVar string
// FuncName is the fully qualified function name (e.g., "(*pkg.Service).Method")
FuncName string
// PackageName is the package name (e.g., "service")
PackageName string
// PackagePath is the full import path (e.g., "github.com/example/myapp/pkg/service")
PackagePath string
// FuncBaseName is the function name without package/receiver (e.g., "Method")
FuncBaseName string
// ReceiverType is the receiver type name (empty if not a method)
ReceiverType string
// ReceiverVar is the receiver variable name (empty if not a method)
ReceiverVar string
// IsMethod indicates whether this is a method
IsMethod bool
// IsPointerReceiver indicates whether the receiver is a pointer
IsPointerReceiver bool
// IsGenericFunc indicates whether the function has type parameters
IsGenericFunc bool
// IsGenericReceiver indicates whether the receiver type has type parameters
IsGenericReceiver bool
}
Vars holds the variables available in templates.
func BuildVars ¶
func BuildVars(df *dst.File, decl *dst.FuncDecl, pkgPath string, carrier config.CarrierDef, varName string) Vars
BuildVars constructs a Vars instance from AST nodes and carrier definition. This function extracts all necessary information from the function declaration and builds template variables that can be used for statement rendering.
Click to show internal directories.
Click to hide internal directories.