firestore

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package firestore provides an in-memory mock implementation of Google Cloud Firestore.

Index

Constants

View Source
const (
	OpEqual        = "="
	OpNotEqual     = "!="
	OpLessThan     = "<"
	OpGreaterThan  = ">"
	OpLessEqual    = "<="
	OpGreaterEqual = ">="
	OpContains     = "CONTAINS"
	OpBeginsWith   = "BEGINS_WITH"
	OpBetween      = "BETWEEN"
)

Scan/query filter operator constants.

View Source
const (
	ViewNewImage  = "NEW_IMAGE"
	ViewOldImage  = "OLD_IMAGE"
	ViewNewAndOld = "NEW_AND_OLD_IMAGES"
	ViewKeysOnly  = "KEYS_ONLY"
)

Snapshot and TTL constants.

Variables

This section is empty.

Functions

This section is empty.

Types

type Mock

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

Mock is an in-memory mock implementation of Google Cloud Firestore.

func New

func New(opts *config.Options) *Mock

New creates a new Firestore mock.

func (*Mock) BatchGetItems

func (m *Mock) BatchGetItems(_ context.Context, table string, keys []map[string]any) ([]map[string]any, error)

func (*Mock) BatchPutItems

func (m *Mock) BatchPutItems(_ context.Context, table string, items []map[string]any) error

func (*Mock) CreateTable

func (m *Mock) CreateTable(_ context.Context, cfg driver.TableConfig) error

func (*Mock) DeleteItem

func (m *Mock) DeleteItem(ctx context.Context, table string, key map[string]any) error

func (*Mock) DeleteTable

func (m *Mock) DeleteTable(_ context.Context, name string) error

func (*Mock) DescribeTTL added in v1.2.0

func (m *Mock) DescribeTTL(_ context.Context, table string) (*driver.TTLConfig, error)

DescribeTTL returns the TTL configuration for a collection.

func (*Mock) DescribeTable

func (m *Mock) DescribeTable(_ context.Context, name string) (*driver.TableConfig, error)

func (*Mock) GetItem

func (m *Mock) GetItem(ctx context.Context, table string, key map[string]any) (map[string]any, error)

func (*Mock) GetStreamRecords added in v1.2.0

func (m *Mock) GetStreamRecords(
	_ context.Context, table string, limit int, token string,
) (*driver.StreamIterator, error)

GetStreamRecords returns snapshot records after the given token.

func (*Mock) ListTables

func (m *Mock) ListTables(_ context.Context) ([]string, error)

func (*Mock) PutItem

func (m *Mock) PutItem(ctx context.Context, table string, item map[string]any) error

func (*Mock) Query

func (m *Mock) Query(ctx context.Context, input driver.QueryInput) (*driver.QueryResult, error)

func (*Mock) Scan

func (m *Mock) Scan(ctx context.Context, input driver.ScanInput) (*driver.QueryResult, error)

func (*Mock) SetMonitoring added in v1.2.0

func (m *Mock) SetMonitoring(mon mondriver.Monitoring)

SetMonitoring sets the monitoring backend for auto-metric generation.

func (*Mock) TransactWriteItems added in v1.2.0

func (m *Mock) TransactWriteItems(
	_ context.Context, table string, puts []map[string]any, deletes []map[string]any,
) error

TransactWriteItems executes puts and deletes atomically.

func (*Mock) UpdateStreamConfig added in v1.2.0

func (m *Mock) UpdateStreamConfig(_ context.Context, table string, cfg driver.StreamConfig) error

UpdateStreamConfig configures real-time listeners for a collection.

func (*Mock) UpdateTTL added in v1.2.0

func (m *Mock) UpdateTTL(_ context.Context, table string, cfg driver.TTLConfig) error

UpdateTTL configures TTL for a collection.

Jump to

Keyboard shortcuts

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