Documentation
¶
Index ¶
Constants ¶
const CurrentVersion = 1
CurrentVersion defines the supported schema version for mergeway.yaml files.
const DefaultWriteTemplate = "{id}.yaml"
DefaultWriteTemplate is the canonical template used for new object files.
const PathIdentifierField = "$path"
PathIdentifierField is the reserved identifier value that derives IDs from file paths.
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.
type FieldDefinition ¶
type FieldDefinition struct {
Name string
Type string
ReferenceTypes []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.
func (*FieldDefinition) HasReferenceUnion ¶ added in v0.3.0
func (d *FieldDefinition) HasReferenceUnion() bool
HasReferenceUnion returns true when the field can reference more than one entity type.
func (*FieldDefinition) IsReference ¶ added in v0.3.0
func (d *FieldDefinition) IsReference() bool
IsReference returns true when the field stores an identifier for one or more entity types.
func (*FieldDefinition) ReferenceLabel ¶ added in v0.3.0
func (d *FieldDefinition) ReferenceLabel() string
ReferenceLabel returns the canonical textual representation of the field's reference targets.
type IdentifierDefinition ¶
IdentifierDefinition specifies the identifier field metadata.
func (IdentifierDefinition) IsPath ¶ added in v0.3.0
func (d IdentifierDefinition) IsPath() bool
IsPath returns true when identifiers are derived from workspace-relative file paths.
type IncludeDefinition ¶
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" )