config

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2025 License: Apache-2.0 Imports: 7 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SaveConfig

func SaveConfig(persister *inyaml.Persister, config *Config) error

SaveConfig saves the configuration to the persister

Types

type BoolVariable added in v1.2.0

type BoolVariable struct {
	Value bool
}

BoolVariable represents a boolean variable

func (BoolVariable) Get added in v1.2.0

func (v BoolVariable) Get(path string) (Variable, bool)

func (BoolVariable) Keys added in v1.2.0

func (v BoolVariable) Keys() []string

func (BoolVariable) Len added in v1.2.0

func (v BoolVariable) Len() int

func (BoolVariable) MarshalJSON added in v1.2.0

func (v BoolVariable) MarshalJSON() ([]byte, error)

func (*BoolVariable) Set added in v1.2.0

func (v *BoolVariable) Set(path string, value Variable) error

func (BoolVariable) String added in v1.2.0

func (v BoolVariable) String() string

func (BoolVariable) Type added in v1.2.0

func (v BoolVariable) Type() VariableType

func (*BoolVariable) UnmarshalJSON added in v1.2.0

func (v *BoolVariable) UnmarshalJSON(data []byte) error

type Config

type Config struct {
	Template   Template   `yaml:"template" json:"template" default:""`
	Output     Output     `yaml:"output" json:"output" default:""`
	Variables  Variables  `yaml:"variables" json:"variables" default:"{}"`
	Engine     Engine     `yaml:"engine" json:"engine" default:"pdflatex"`
	Conversion Conversion `yaml:"conversion" json:"conversion"`
}

Config defines the YAML configuration schema for AutoPDF

func GetConfig

func GetConfig(persister *inyaml.Persister) (*Config, error)

GetConfig retrieves the configuration from the persister

func GetDefaultConfig

func GetDefaultConfig() *Config

GetDefaultConfig returns a default configuration

func NewConfigFromYAML

func NewConfigFromYAML(yamlData []byte) (*Config, error)

NewConfigFromYAML creates a new Config from YAML data

func (*Config) Marshal

func (c *Config) Marshal() ([]byte, error)

func (*Config) String

func (c *Config) String() string

func (*Config) ToJSON

func (c *Config) ToJSON() (string, error)

ToJSON converts a Config to JSON string representation

func (*Config) Unmarshal

func (c *Config) Unmarshal(data []byte) error

type Conversion

type Conversion struct {
	Enabled bool     `yaml:"enabled" json:"enabled" default:"false"`
	Formats []string `yaml:"formats" json:"formats" default:"[]"`
}

type Engine

type Engine string

func (Engine) String

func (e Engine) String() string

type MapVariable added in v1.2.0

type MapVariable struct {
	Values map[string]Variable
}

MapVariable represents a map of nested variables

func NewMapVariable added in v1.2.0

func NewMapVariable() *MapVariable

func (MapVariable) Get added in v1.2.0

func (v MapVariable) Get(path string) (Variable, bool)

func (MapVariable) Keys added in v1.2.0

func (v MapVariable) Keys() []string

func (MapVariable) Len added in v1.2.0

func (v MapVariable) Len() int

func (MapVariable) MarshalJSON added in v1.2.0

func (v MapVariable) MarshalJSON() ([]byte, error)

func (*MapVariable) Set added in v1.2.0

func (v *MapVariable) Set(path string, value Variable) error

func (MapVariable) String added in v1.2.0

func (v MapVariable) String() string

func (MapVariable) Type added in v1.2.0

func (v MapVariable) Type() VariableType

func (*MapVariable) UnmarshalJSON added in v1.2.0

func (v *MapVariable) UnmarshalJSON(data []byte) error

type NumberVariable added in v1.2.0

type NumberVariable struct {
	Value float64
}

NumberVariable represents a numeric variable

func (NumberVariable) Get added in v1.2.0

func (v NumberVariable) Get(path string) (Variable, bool)

func (NumberVariable) Keys added in v1.2.0

func (v NumberVariable) Keys() []string

func (NumberVariable) Len added in v1.2.0

func (v NumberVariable) Len() int

func (NumberVariable) MarshalJSON added in v1.2.0

func (v NumberVariable) MarshalJSON() ([]byte, error)

func (*NumberVariable) Set added in v1.2.0

func (v *NumberVariable) Set(path string, value Variable) error

func (NumberVariable) String added in v1.2.0

func (v NumberVariable) String() string

func (NumberVariable) Type added in v1.2.0

func (v NumberVariable) Type() VariableType

func (*NumberVariable) UnmarshalJSON added in v1.2.0

func (v *NumberVariable) UnmarshalJSON(data []byte) error

type Output

type Output string

func (Output) String

func (o Output) String() string

type SliceVariable added in v1.2.0

type SliceVariable struct {
	Values []Variable
}

SliceVariable represents a slice of variables

func NewSliceVariable added in v1.2.0

func NewSliceVariable() *SliceVariable

func (SliceVariable) Get added in v1.2.0

func (v SliceVariable) Get(path string) (Variable, bool)

func (SliceVariable) Keys added in v1.2.0

func (v SliceVariable) Keys() []string

func (SliceVariable) Len added in v1.2.0

func (v SliceVariable) Len() int

func (SliceVariable) MarshalJSON added in v1.2.0

func (v SliceVariable) MarshalJSON() ([]byte, error)

func (*SliceVariable) Set added in v1.2.0

func (v *SliceVariable) Set(path string, value Variable) error

func (SliceVariable) String added in v1.2.0

func (v SliceVariable) String() string

func (SliceVariable) Type added in v1.2.0

func (v SliceVariable) Type() VariableType

func (*SliceVariable) UnmarshalJSON added in v1.2.0

func (v *SliceVariable) UnmarshalJSON(data []byte) error

type StringVariable added in v1.2.0

type StringVariable struct {
	Value string
}

StringVariable represents a simple string variable

func (StringVariable) Get added in v1.2.0

func (v StringVariable) Get(path string) (Variable, bool)

func (StringVariable) Keys added in v1.2.0

func (v StringVariable) Keys() []string

func (StringVariable) Len added in v1.2.0

func (v StringVariable) Len() int

func (StringVariable) MarshalJSON added in v1.2.0

func (v StringVariable) MarshalJSON() ([]byte, error)

func (*StringVariable) Set added in v1.2.0

func (v *StringVariable) Set(path string, value Variable) error

func (StringVariable) String added in v1.2.0

func (v StringVariable) String() string

func (StringVariable) Type added in v1.2.0

func (v StringVariable) Type() VariableType

func (*StringVariable) UnmarshalJSON added in v1.2.0

func (v *StringVariable) UnmarshalJSON(data []byte) error

type Template

type Template string

func (Template) String

func (t Template) String() string

type Variable added in v1.2.0

type Variable interface {
	// String returns the string representation for template substitution
	String() string
	// Get retrieves a nested value by path (e.g., "foo.bar[0]")
	Get(path string) (Variable, bool)
	// Set sets a nested value by path
	Set(path string, value Variable) error
	// Keys returns the keys for map-like variables
	Keys() []string
	// Len returns the length for slice-like variables
	Len() int
	// Type returns the variable type
	Type() VariableType
	// MarshalJSON implements json.Marshaler
	MarshalJSON() ([]byte, error)
	// UnmarshalJSON implements json.Unmarshaler
	UnmarshalJSON(data []byte) error
}

Variable represents a complex variable that can be: - A simple string value - A map of nested variables - A slice of values - Any combination of the above

type VariableSet added in v1.2.0

type VariableSet struct {
	// contains filtered or unexported fields
}

VariableSet represents a collection of variables with complex operations

func NewVariableSet added in v1.2.0

func NewVariableSet() *VariableSet

func (*VariableSet) Flatten added in v1.2.0

func (vs *VariableSet) Flatten() map[string]string

FlattenVariables flattens nested variables into dot-notation paths

func (*VariableSet) Get added in v1.2.0

func (vs *VariableSet) Get(name string) (Variable, bool)

func (*VariableSet) GetByPath added in v1.2.0

func (vs *VariableSet) GetByPath(path string) (Variable, bool)

func (*VariableSet) GetString added in v1.2.0

func (vs *VariableSet) GetString(name string) (string, bool)

func (*VariableSet) GetVariables added in v1.2.0

func (vs *VariableSet) GetVariables() map[string]Variable

GetVariables returns a copy of the variables map for template processing

func (*VariableSet) Keys added in v1.2.0

func (vs *VariableSet) Keys() []string

func (*VariableSet) Len added in v1.2.0

func (vs *VariableSet) Len() int

func (*VariableSet) MarshalJSON added in v1.2.0

func (vs *VariableSet) MarshalJSON() ([]byte, error)

func (*VariableSet) Range added in v1.2.0

func (vs *VariableSet) Range(fn func(name string, value Variable) bool)

RangeVariables provides iteration over variables

func (*VariableSet) Set added in v1.2.0

func (vs *VariableSet) Set(name string, value Variable)

func (*VariableSet) SetByPath added in v1.2.0

func (vs *VariableSet) SetByPath(path string, value Variable) error

func (*VariableSet) UnmarshalJSON added in v1.2.0

func (vs *VariableSet) UnmarshalJSON(data []byte) error

type VariableType added in v1.2.0

type VariableType int

VariableType represents the type of a variable

const (
	VariableTypeString VariableType = iota
	VariableTypeMap
	VariableTypeSlice
	VariableTypeNumber
	VariableTypeBool
)

type Variables

type Variables struct {
	*VariableSet
}

Variables represents a collection of complex variables

func NewVariables added in v1.2.0

func NewVariables() *Variables

NewVariables creates a new Variables collection

func (Variables) GetString added in v1.2.0

func (v Variables) GetString(path string) (string, bool)

GetString gets a string value by path (for backward compatibility)

func (Variables) MarshalJSON added in v1.2.0

func (v Variables) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler

func (Variables) MarshalYAML added in v1.2.0

func (v Variables) MarshalYAML() (interface{}, error)

MarshalYAML implements yaml.Marshaler

func (*Variables) SetString added in v1.2.0

func (v *Variables) SetString(path string, value string) error

SetString sets a string value by path (for backward compatibility)

func (Variables) String

func (v Variables) String() string

String returns the string representation

func (*Variables) UnmarshalJSON added in v1.2.0

func (v *Variables) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler

func (*Variables) UnmarshalYAML added in v1.2.0

func (v *Variables) UnmarshalYAML(value *yaml.Node) error

UnmarshalYAML implements yaml.Unmarshaler

Jump to

Keyboard shortcuts

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