file

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

README

file

Sinks metadata to a file in ndjson/yaml format as per the config defined.

Usage

sinks:
    name: file
    config:
        path: "./dir/sample.yaml"
        format: "yaml"
        overwrite: false

Config Defination

Key Value Example Description
path string ./dir/sample.yaml absolute or relative path from binary to output file, directory should exist required
format string yaml data format for the output file required
overwrite bool false to choose whether data should be overwritten or appended in case file exists, default is true optional

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