Help us shape the future of Go! Take the 2026 Go Developer Survey

storage

package
v0.1.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CSVStorage

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

CSVStorage writes items as CSV rows.

func NewCSVStorage

func NewCSVStorage(outputPath string, logger *slog.Logger) (*CSVStorage, error)

NewCSVStorage creates a new CSV file storage.

func (*CSVStorage) Close

func (s *CSVStorage) Close() error

func (*CSVStorage) Name

func (s *CSVStorage) Name() string

func (*CSVStorage) Store

func (s *CSVStorage) Store(items []*types.Item) error

type JSONLStorage

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

JSONLStorage writes items as newline-delimited JSON (one object per line).

func NewJSONLStorage

func NewJSONLStorage(outputPath string, logger *slog.Logger) (*JSONLStorage, error)

NewJSONLStorage creates a new JSONL file storage (streaming writes).

func (*JSONLStorage) Close

func (s *JSONLStorage) Close() error

func (*JSONLStorage) Name

func (s *JSONLStorage) Name() string

func (*JSONLStorage) Store

func (s *JSONLStorage) Store(items []*types.Item) error

type JSONStorage

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

JSONStorage writes items as a JSON array to a file.

func NewJSONStorage

func NewJSONStorage(outputPath string, logger *slog.Logger) (*JSONStorage, error)

NewJSONStorage creates a new JSON file storage.

func (*JSONStorage) Close

func (s *JSONStorage) Close() error

func (*JSONStorage) Name

func (s *JSONStorage) Name() string

func (*JSONStorage) Store

func (s *JSONStorage) Store(items []*types.Item) error

type MongoStorage

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

MongoStorage writes items to a MongoDB collection.

func NewMongoStorage

func NewMongoStorage(uri, database, collection string, logger *slog.Logger) (*MongoStorage, error)

NewMongoStorage creates a new MongoDB storage backend.

func (*MongoStorage) Close

func (s *MongoStorage) Close() error

func (*MongoStorage) Name

func (s *MongoStorage) Name() string

func (*MongoStorage) Store

func (s *MongoStorage) Store(items []*types.Item) error

type MultiStorage

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

MultiStorage writes items to multiple backends simultaneously.

func NewMultiStorage

func NewMultiStorage(backends []Storage, logger *slog.Logger) *MultiStorage

NewMultiStorage creates a storage that fans out to multiple backends.

func (*MultiStorage) Close

func (s *MultiStorage) Close() error

func (*MultiStorage) Name

func (s *MultiStorage) Name() string

func (*MultiStorage) Store

func (s *MultiStorage) Store(items []*types.Item) error

type Storage

type Storage interface {
	// Store persists a batch of items.
	Store(items []*types.Item) error

	// Close flushes pending writes and releases resources.
	Close() error

	// Name returns the storage backend identifier.
	Name() string
}

Storage is the interface for all storage backends.

func NewFileStorage

func NewFileStorage(storageType, outputDir string, logger *slog.Logger) (Storage, error)

NewFileStorage creates the appropriate file-based storage by type.

Jump to

Keyboard shortcuts

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