file

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

README

File

Write metadata records to a local file in NDJSON or YAML format.

Usage

sinks:
  - name: file
    config:
      path: "./output/metadata.ndjson"
      format: "ndjson"
      overwrite: false

Configuration

Key Type Example Description
path string ./dir/sample.ndjson Absolute or relative path to the output file. The parent directory must exist. required
format string ndjson Output format: ndjson or yaml required
overwrite bool true When true (default), the file is truncated on init. When false, data is appended to an existing file. optional

Behavior

Each Record (Entity + Edges) is serialized as JSON. In ndjson mode, one JSON object per line is written. In yaml mode, all records in a batch are written as a YAML list.

Contributing

Refer to the contribution guidelines for information on contributing to this module.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(logger log.Logger) plugins.Syncer

Types

type Config

type Config struct {
	Overwrite bool   `mapstructure:"overwrite" default:"true"`
	Path      string `mapstructure:"path" validate:"required"`
	Format    string `mapstructure:"format" validate:"required"`
}

type Sink

type Sink struct {
	plugins.BasePlugin

	File *os.File
	// contains filtered or unexported fields
}

func (*Sink) Close

func (s *Sink) Close() (err error)

func (*Sink) Init

func (s *Sink) Init(ctx context.Context, config plugins.Config) error

func (*Sink) Sink

func (s *Sink) Sink(ctx context.Context, batch []models.Record) (err error)

Jump to

Keyboard shortcuts

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