Documentation
¶
Index ¶
- type ExampleImageInjector
- func (i *ExampleImageInjector) Code() string
- func (i *ExampleImageInjector) DataType() entity.ValueType
- func (i *ExampleImageInjector) DefaultValue() *entity.InjectableValue
- func (i *ExampleImageInjector) Formats() *entity.FormatConfig
- func (i *ExampleImageInjector) IsCritical() bool
- func (i *ExampleImageInjector) Resolve() (port.ResolveFunc, []string)
- func (i *ExampleImageInjector) Timeout() time.Duration
- type ExampleInjector
- func (i *ExampleInjector) Code() string
- func (i *ExampleInjector) DataType() entity.ValueType
- func (i *ExampleInjector) DefaultValue() *entity.InjectableValue
- func (i *ExampleInjector) Formats() *entity.FormatConfig
- func (i *ExampleInjector) IsCritical() bool
- func (i *ExampleInjector) Resolve() (port.ResolveFunc, []string)
- func (i *ExampleInjector) Timeout() time.Duration
- type ExampleTableInjector
- func (i *ExampleTableInjector) Code() string
- func (i *ExampleTableInjector) ColumnSchema() []entity.TableColumn
- func (i *ExampleTableInjector) DataType() entity.ValueType
- func (i *ExampleTableInjector) DefaultValue() *entity.InjectableValue
- func (i *ExampleTableInjector) Formats() *entity.FormatConfig
- func (i *ExampleTableInjector) IsCritical() bool
- func (i *ExampleTableInjector) Resolve() (port.ResolveFunc, []string)
- func (i *ExampleTableInjector) Timeout() time.Duration
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ExampleImageInjector ¶
type ExampleImageInjector struct{}
ExampleImageInjector is an example injector that returns a sample image URL. This demonstrates how to implement an IMAGE type injectable.
IMAGE injectables return string URLs that are resolved when rendering documents. The frontend displays the image using the resolved URL.
func (*ExampleImageInjector) Code ¶
func (i *ExampleImageInjector) Code() string
Code returns the unique identifier of the injector.
func (*ExampleImageInjector) DataType ¶
func (i *ExampleImageInjector) DataType() entity.ValueType
DataType returns the type of value this injector produces.
func (*ExampleImageInjector) DefaultValue ¶
func (i *ExampleImageInjector) DefaultValue() *entity.InjectableValue
DefaultValue returns the default value if resolution fails.
func (*ExampleImageInjector) Formats ¶
func (i *ExampleImageInjector) Formats() *entity.FormatConfig
Formats returns the format configuration for this injector.
func (*ExampleImageInjector) IsCritical ¶
func (i *ExampleImageInjector) IsCritical() bool
IsCritical indicates if an error in this injector should stop the process.
func (*ExampleImageInjector) Resolve ¶
func (i *ExampleImageInjector) Resolve() (port.ResolveFunc, []string)
Resolve returns the resolution function and the list of dependencies.
func (*ExampleImageInjector) Timeout ¶
func (i *ExampleImageInjector) Timeout() time.Duration
Timeout returns the timeout for this injector.
type ExampleInjector ¶
type ExampleInjector struct{}
ExampleInjector is an example injector that demonstrates how to implement the port.Injector interface.
To create a new injector:
- Add the //docengine:injector comment before the struct
- Implement the methods: Code(), Resolve(), IsCritical(), Timeout(), DataType(), DefaultValue(), Formats()
- Add translations in settings/injectors.i18n.yaml
- Run: make gen
func (*ExampleInjector) Code ¶
func (i *ExampleInjector) Code() string
Code returns the unique identifier of the injector. This code is used to map with translations in injectors.i18n.yaml.
func (*ExampleInjector) DataType ¶
func (i *ExampleInjector) DataType() entity.ValueType
DataType returns the type of value this injector produces. Used by frontend for display and validation.
func (*ExampleInjector) DefaultValue ¶
func (i *ExampleInjector) DefaultValue() *entity.InjectableValue
DefaultValue returns the default value if resolution fails. Return nil for no default (error will be raised if critical).
func (*ExampleInjector) Formats ¶
func (i *ExampleInjector) Formats() *entity.FormatConfig
Formats returns the format configuration for this injector. Return nil if formatting is not applicable.
func (*ExampleInjector) IsCritical ¶
func (i *ExampleInjector) IsCritical() bool
IsCritical indicates if an error in this injector should stop the process. If true: the error stops document generation. If false: the error is logged and continues (the value remains empty).
func (*ExampleInjector) Resolve ¶
func (i *ExampleInjector) Resolve() (port.ResolveFunc, []string)
Resolve returns the resolution function and the list of dependencies. - The function resolves and returns the injector's value. - Dependencies are codes of other injectors that must execute first.
func (*ExampleInjector) Timeout ¶
func (i *ExampleInjector) Timeout() time.Duration
Timeout returns the timeout for this injector. If 0, the global default timeout (30s) is used.
type ExampleTableInjector ¶
type ExampleTableInjector struct{}
ExampleTableInjector demonstrates how to create a table injector. This is for DEMONSTRATION PURPOSES ONLY - do not use in production.
To create a real table injector:
- Copy this file as a starting point
- Modify Code() to return your unique identifier
- Implement Resolve() to build your table from InitData or RequestPayload
- Add translations in settings/injectors.i18n.yaml
- Run: make gen
func (*ExampleTableInjector) Code ¶
func (i *ExampleTableInjector) Code() string
Code returns the unique identifier of the injector.
func (*ExampleTableInjector) ColumnSchema ¶
func (i *ExampleTableInjector) ColumnSchema() []entity.TableColumn
ColumnSchema returns the column definitions for this table injector. Implements port.TableSchemaProvider.
func (*ExampleTableInjector) DataType ¶
func (i *ExampleTableInjector) DataType() entity.ValueType
DataType returns the type of value this injector produces.
func (*ExampleTableInjector) DefaultValue ¶
func (i *ExampleTableInjector) DefaultValue() *entity.InjectableValue
DefaultValue returns the default value if resolution fails.
func (*ExampleTableInjector) Formats ¶
func (i *ExampleTableInjector) Formats() *entity.FormatConfig
Formats returns the format configuration for this injector.
func (*ExampleTableInjector) IsCritical ¶
func (i *ExampleTableInjector) IsCritical() bool
IsCritical indicates if an error in this injector should stop the process.
func (*ExampleTableInjector) Resolve ¶
func (i *ExampleTableInjector) Resolve() (port.ResolveFunc, []string)
Resolve returns the resolution function and the list of dependencies.
func (*ExampleTableInjector) Timeout ¶
func (i *ExampleTableInjector) Timeout() time.Duration
Timeout returns the timeout for this injector.