Skip to content

Commit

Permalink
docs(firestore): adds emulator snippet (#6926)
Browse files Browse the repository at this point in the history
  • Loading branch information
Eric Schmidt committed Oct 26, 2022
1 parent 27363ca commit 456afab
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions firestore/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -247,5 +247,17 @@ directed to the emulator instead of the production Firestore service.
To install and run the emulator and its environment variables, see the documentation
at https://cloud.google.com/sdk/gcloud/reference/beta/emulators/firestore/. Once the
emulator is running, set FIRESTORE_EMULATOR_HOST to the API endpoint.
// Set FIRESTORE_EMULATOR_HOST environment variable.
err := os.Setenv("FIRESTORE_EMULATOR_HOST", "localhost:9000")
if err != nil {
// TODO: Handle error.
}
// Create client as usual.
client, err := firestore.NewClient(ctx, "my-project-id")
if err != nil {
// TODO: Handle error.
}
defer client.Close()
*/
package firestore

0 comments on commit 456afab

Please sign in to comment.