firestoreutil

package
v0.0.0-...-43b2f59 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2021 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package firestoreutil contains test utilities for starting a firestore emulator locally.

Index

Constants

View Source
const FirestoreEmulatorHost = "localhost"
View Source
const FirestoreEmulatorPort = "8010"
View Source
const FirestoreEmulatorProject = "dummy-emulator-firestore-project"

Variables

This section is empty.

Functions

func BatchDeleteAll

func BatchDeleteAll(ctx context.Context, cl *firestore.Client, it *firestore.DocumentIterator) error

BatchDeleteAll deletes all returned results in batches of sizes allowed by firestore.

func ImportData

func ImportData(r io.Reader, c *firestore.Client) error

ImportData loads data into firestore from a newline-separated json doc file with objects in format:

{"p": "col/<NAME>/<SUBCOL>/<NAME>", "v": {base64 then gob-encoded map[string]interface{}}
{"p": "col/<NAME>/<SUBCOL>/<NAME>", "v": {base64 then gob-encoded map[string]interface{}}

func StartEmulator

func StartEmulator(ctx context.Context) (*firestore.Client, func(), error)

func StartTestEmulator

func StartTestEmulator(t *testing.T, ctx context.Context) *firestore.Client

Types

type Doc

type Doc struct {
	Path  string `json:"p"`
	Value []byte `json:"v"`
}

Jump to

Keyboard shortcuts

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