config

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const CurrentVersion = 1

CurrentVersion defines the supported schema version for mergeway.yaml files.

View Source
const DefaultWriteTemplate = "{id}.yaml"

DefaultWriteTemplate is the canonical template used for new object files.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Version int
	Types   map[string]*TypeDefinition
	Write   WriteDefaults
}

Config captures the normalized database configuration.

func Load

func Load(path string) (*Config, error)

Load reads the configuration entry file and resolves includes.

func (*Config) Sources

func (c *Config) Sources() []string

Sources returns a sorted list of files that contributed entity definitions.

func (*Config) String

func (c *Config) String() string

String returns a string representation for debugging purposes.

type FieldDefinition

type FieldDefinition struct {
	Name          string
	Type          string
	Required      bool
	Repeated      bool
	Format        string
	Enum          []string
	Default       any
	Properties    map[string]*FieldDefinition
	Unique        bool
	Pattern       string
	Description   string
	PropertyOrder []string
}

FieldDefinition holds schema information for a field.

type IdentifierDefinition

type IdentifierDefinition struct {
	Field     string
	Generated bool
	Pattern   string
}

IdentifierDefinition specifies the identifier field metadata.

type IncludeDefinition

type IncludeDefinition struct {
	Path     string
	Selector string
}

IncludeDefinition links a type to data files and selectors.

type TypeDefinition

type TypeDefinition struct {
	Name        string
	Source      string
	Description string
	JSONSchema  string
	Identifier  IdentifierDefinition
	Include     []IncludeDefinition
	Fields      map[string]*FieldDefinition
	FieldOrder  []string
	InlineData  []map[string]any
	Write       WriteDefinition
}

TypeDefinition describes a single object type.

type WriteDefaults

type WriteDefaults struct {
	Template string
	Format   WriteFormat
}

WriteDefaults captures global defaults for write behaviour.

type WriteDefinition

type WriteDefinition struct {
	Template string
	Format   WriteFormat
}

WriteDefinition describes how to emit a single object to disk.

type WriteFormat

type WriteFormat string

WriteFormat enumerates supported serialization formats for writes.

const (
	WriteFormatYAML WriteFormat = "yaml"
	WriteFormatJSON WriteFormat = "json"
)

Jump to

Keyboard shortcuts

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