Documentation
¶
Overview ¶
Package importer provides functionality to import entities and relations from JSON, YAML, and CSV files into rela projects.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EntityData ¶
type EntityData struct {
ID string `json:"id" yaml:"id"`
Type string `json:"type" yaml:"type"`
Properties map[string]interface{} `json:"properties,omitempty" yaml:"properties,omitempty"`
}
EntityData represents an entity to import
type ImportData ¶
type ImportData struct {
Entities []EntityData
Relations []RelationData
}
ImportData represents the parsed import data
type ImportError ¶
type ImportError struct {
Type string // "entity" or "relation"
ID string // entity ID or relation key
Message string
}
ImportError represents an error during import with context
func (ImportError) Error ¶
func (e ImportError) Error() string
type ImportSource ¶
type ImportSource struct {
// contains filtered or unexported fields
}
ImportSource provides filesystem access for reading import input files. It wraps a storage.FS to make the intent explicit: the FS is for reading source data (CSV, JSON, YAML), which may be on a different filesystem than the project's repository.
func NewImportSource ¶
func NewImportSource(fs storage.FS) *ImportSource
NewImportSource creates an ImportSource from a filesystem.
func (*ImportSource) Open ¶
func (s *ImportSource) Open(path string) (io.ReadCloser, error)
Open opens a file for reading from the import source.
type Importer ¶
type Importer struct {
// contains filtered or unexported fields
}
Importer handles importing data into a rela project
func New ¶
func New( repo repository.Store, meta *metamodel.Metamodel, g *graph.Graph, opts Options, source *ImportSource, ) *Importer
New creates a new Importer that reads input files from the given source.
type Options ¶
type Options struct {
// Format specifies the input format. If empty, auto-detected from file extension.
Format Format
// DryRun validates without creating files
DryRun bool
// Update allows updating existing entities instead of failing on duplicates
Update bool
// SkipErrors continues importing on validation errors
SkipErrors bool
// RelationsFile is the path to a separate relations CSV file (for CSV imports)
RelationsFile string
}
Options configures the import behavior
type RelationData ¶
type RelationData struct {
From string `json:"from" yaml:"from"`
Relation string `json:"relation" yaml:"relation"`
To string `json:"to" yaml:"to"`
Properties map[string]interface{} `json:"properties,omitempty" yaml:"properties,omitempty"`
}
RelationData represents a relation to import