filebatch

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2026 License: MIT Imports: 11 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package filebatch writes a batch of evaluation events to a file: the file name from a template, and the content in JSON lines, CSV or Parquet. The file exporter writes the file where it is wanted; the exporters of the object stores (S3, Google Cloud Storage, Azure Blob Storage) write it to a temporary directory and upload it. The package is theirs to share: no exporter imports another.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Writer

type Writer struct {

	// Format is the output format you want in your exported file.
	// Available format are JSON, CSV, and Parquet.
	// Default: JSON
	Format string
	// OutputDir is the location of the directory where to store the exported files
	// Default: the current directory
	OutputDir string
	// Filename is the name of your output file
	// You can use a templated config to define the name of your export files.
	// Available replacement are {{ .Hostname}}, {{ .Timestamp}} and {{ .Format}}.
	// {{ .Timestamp}} is the milliseconds since the epoch followed by 12 random digits. Two exports in the
	// same millisecond get the same name with a chance of about 1 in 10^12 (see exporter.ComputeFilename).
	// Default: "flag-variation-{{ .Hostname}}-{{ .Timestamp}}.{{ .Format}}"
	Filename string
	// CsvTemplate is used if your output format is CSV.
	// This field will be ignored if you are using another format than CSV.
	// You can decide which fields you want in your CSV line with a go-template syntax,
	// please check exporter/feature_event.go to see what are the fields available.
	// Default:
	// {{ .Kind}};{{ .ContextKind}};{{ .UserKey}};{{ .CreationDate}};{{ .Key}};{{ .Variation}};{{ .Value}};
	// {{ .Default}};{{ .Source}}\n
	CsvTemplate string
	// ParquetCompressionCodec is the parquet compression codec for better space efficiency.
	// Available options https://github.com/apache/parquet-format/blob/master/Compression.md
	// Default: SNAPPY
	ParquetCompressionCodec string
	// contains filtered or unexported fields
}

Writer writes a batch of evaluation events to one file of a directory in the format of its fields: the part of the file exporter that the exporters of the object stores share (they write the batch to a temporary directory and upload the file). The zero value is ready to use and not safe for concurrent use.

func (*Writer) Write

func (f *Writer) Write(events []exporter.ExportableEvent) error

Write saves a collection of events in a new file: the file name comes from the filename template and the file is in OutputDir (the current directory when empty). The Format is set to its default and lower cased.

Jump to

Keyboard shortcuts

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