sheets

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: 12 Imported by: 0

Documentation

Overview

Package sheets implements a Writer that writes transactions to Google Sheets.

Index

Constants

View Source
const (
	DefaultBatchSize     = 10
	DefaultFlushInterval = 30 * time.Second
)

Default configuration values for buffered writes.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// SheetTitle is the title for a new spreadsheet (if SheetID is empty).
	SheetTitle string
	// SheetID is the ID of an existing spreadsheet to use.
	SheetID string
	// SheetName is the name of the sheet within the spreadsheet.
	SheetName string
	// BatchSize is the number of transactions to buffer before writing.
	// Defaults to DefaultBatchSize.
	BatchSize int
	// FlushInterval is the interval between automatic flushes.
	// Defaults to DefaultFlushInterval.
	FlushInterval time.Duration
}

Config holds configuration for the Sheets writer.

type Writer

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

Writer writes transactions to a Google Sheet with buffered batching.

func New

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

New creates a new Sheets writer.

func (*Writer) BufferLen

func (w *Writer) BufferLen() int

BufferLen returns the current number of buffered transactions.

func (*Writer) SpreadsheetID

func (w *Writer) SpreadsheetID() string

SpreadsheetID returns the ID of the spreadsheet being written to.

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 Google Sheets.

Jump to

Keyboard shortcuts

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