json

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2026 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Overview

Package json implements a Writer that writes transactions to a JSON file.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// FilePath is the path to the JSON output file.
	FilePath string
	// BatchSize is the number of transactions to buffer before writing.
	BatchSize int
	// FlushInterval is the interval between automatic flushes (seconds).
	FlushInterval int
}

Config holds configuration for the JSON writer.

type Writer

type Writer struct {
	// contains filtered or unexported fields
}

Writer writes transactions to a JSON file with buffered batching.

func New

func New(cfg Config, logger *slog.Logger) (*Writer, error)

New creates a new JSON writer.

func (*Writer) TransactionCount

func (w *Writer) TransactionCount() int

TransactionCount returns the total number of transactions written.

func (*Writer) Write

func (w *Writer) Write(ctx context.Context, in <-chan *api.TransactionDetails, ackChan chan<- string) error

Write consumes transactions from the input channel and writes them to JSON.

Jump to

Keyboard shortcuts

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