Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Variadic ¶
type Variadic struct { // Template embeds the default logic of the template framework. *codegen.Template // contains filtered or unexported fields }
Variadic is a template that translates code into a set of variadic implementations with generic type parameters.
It supports the following pipelines:
+---------------+----------+------------------------------------------------------------+---------------------------+ | Pipeline | Type | Description | Example Output | +---------------+----------+------------------------------------------------------------+---------------------------+ | hasParams | bool | true if the currently generated variadic has parameters. | true | | paramCount | int | the current number of variadic parameters. | 2 | | params | string | the current list of variadic parameters (without types). | i.e. "arg1, arg2" | | typedParams | string | the current list of variadic parameters (including types). | i.e. "arg1 T1, arg2 T2" | | types | string | the current list of variadic types. | i.e. "T1, T2" | +---------------+----------+------------------------------------------------------------+---------------------------+
func (*Variadic) Generate ¶
func (v *Variadic) Generate(fileName string, minParamCount, maxParamCount int, optGenerator ...func() (string, error)) error
Generate generates a file containing the desired number of variadic instances (it can receive an optional generator function that overrides the way the Content is generated).
func (*Variadic) GenerateContent ¶
GenerateContent generates multiple variadic instances of the template according to the current configuration.