injectors

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: May 5, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

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

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:

  1. Add the //docengine:injector comment before the struct
  2. Implement the methods: Code(), Resolve(), IsCritical(), Timeout(), DataType(), DefaultValue(), Formats()
  3. Add translations in settings/injectors.i18n.yaml
  4. 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:

  1. Copy this file as a starting point
  2. Modify Code() to return your unique identifier
  3. Implement Resolve() to build your table from InitData or RequestPayload
  4. Add translations in settings/injectors.i18n.yaml
  5. 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

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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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