Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
f83aca1
feat(firestore): add pipeline queries (#12217)
bhshkh May 21, 2025
f069709
feat(firestore): Add rest of the input stages (#12425)
bhshkh Jun 16, 2025
cdcb907
feat(firestore): Add pipeline expressions basic structure (#12538)
bhshkh Jul 15, 2025
ac7b0c6
Merge remote-tracking branch 'upstream/main' into feature/fs-pipeline…
bhshkh Oct 15, 2025
0a16570
add pipeline queries protos
bhshkh Oct 15, 2025
78aebb5
Merge remote-tracking branch 'upstream/main' into feature/fs-pipeline…
bhshkh Oct 15, 2025
ea82387
feat(firestore): add all the remaining arithmetic and comparison func…
bhshkh Oct 21, 2025
c172ba8
Merge remote-tracking branch 'upstream/main' into feature/fs-pipeline…
bhshkh Oct 21, 2025
22aca97
test(firestore): Modify integration test to run on enterprise db (#13…
bhshkh Oct 23, 2025
a3ee1f1
Merge remote-tracking branch 'upstream/main' into feature/fs-pipeline…
bhshkh Oct 27, 2025
f1df882
feat(firestore): [PQ] Add all Aggregation and Timestamp functions (#1…
bhshkh Oct 30, 2025
d27101e
feat(firestore): [PQ] add all the remaining private preview stages (#…
bhshkh Oct 30, 2025
768e559
feat(firestore): [PQ] add all array, string and vector functions (#13…
bhshkh Oct 30, 2025
9dd006f
Merge remote-tracking branch 'upstream/main' into feature/fs-pipeline…
bhshkh Oct 30, 2025
6f6c58c
test(firestore): [PQ] move tests and resolve build failures (#13270)
bhshkh Oct 30, 2025
a2fb94c
refactor(firestore): Combine FieldOf and FieldOfPath (#13271)
bhshkh Oct 30, 2025
8cbe308
Merge remote-tracking branch 'upstream/main' into feature/fs-pipeline…
bhshkh Nov 3, 2025
80b7289
refactor(firestore): [PQ] Remove types functions (#13279)
bhshkh Oct 31, 2025
42d3442
feat(firestore): [PQ] add raw stage (#13280)
bhshkh Nov 3, 2025
3584537
feat(firestore): [PQ] add consistency selector (#13282)
bhshkh Nov 3, 2025
d958103
Merge remote-tracking branch 'upstream/main' into feature/fs-pipeline…
bhshkh Nov 6, 2025
b80712a
feat(firestore): [PQ] general, key, type, logical and object function…
bhshkh Nov 10, 2025
7181aac
refactor(firestore): Rename Expr to Expression (#13338)
bhshkh Nov 10, 2025
34fdab6
feat(firestore): [PQ] add collection stage options (#13281)
bhshkh Nov 10, 2025
4810a72
feat(firestore): [PQ] add executeoptions (#13274)
bhshkh Nov 10, 2025
4362b9f
Merge remote-tracking branch 'upstream/main' into feature/fs-pipeline…
bhshkh Nov 11, 2025
dd603ae
feat(firestore): [PQ] create pipeline from query (#13339)
bhshkh Nov 13, 2025
26a9f58
Merge branch 'main' into feature/fs-pipeline-queries
bhshkh Nov 19, 2025
1642ca7
Merge remote-tracking branch 'upstream/main' into feature/fs-pipeline…
bhshkh Nov 19, 2025
06301fa
Merge remote-tracking branch 'upstream/main' into feature/fs-pipeline…
bhshkh Jan 13, 2026
2ed3185
chore(firestore): [PQ] update copyright year (#13589)
bhshkh Jan 13, 2026
adb582c
feat(firestore): [PQ] introduce pipeline snapshots (#13588)
bhshkh Jan 13, 2026
a18aca3
refactor(firestore): [PQ] refactor CountIf, Replace, Unnest and renam…
bhshkh Jan 13, 2026
8ea265e
refactor(firestore): [PQ] remove index mode (#13595)
bhshkh Jan 13, 2026
91dd8b9
Merge remote-tracking branch 'upstream/main' into feature/fs-pipeline…
bhshkh Jan 13, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion firestore/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const resourcePrefixHeader = "google-cloud-resource-prefix"
// requestParamsHeader is routing header required to access named databases
const reqParamsHeader = "x-goog-request-params"

// reqParamsHeaderVal constructs header from dbPath
// reqParamsHeaderVal constructs header from dbPath.
// dbPath is of the form projects/{project_id}/databases/{database_id}
func reqParamsHeaderVal(dbPath string) string {
splitPath := strings.Split(dbPath, "/")
Expand Down Expand Up @@ -181,6 +181,11 @@ func withRequestParamsHeader(ctx context.Context, requestParams string) context.
return metadata.NewOutgoingContext(ctx, md)
}

// Pipeline creates a PipelineSource to start building a Firestore pipeline.
func (c *Client) Pipeline() *PipelineSource {
return &PipelineSource{client: c}
}

// Collection creates a reference to a collection with the given path.
// A path is a sequence of IDs separated by slashes.
//
Expand Down
62 changes: 44 additions & 18 deletions firestore/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,29 @@ import (
"google.golang.org/protobuf/types/known/structpb"
)

func TestMain(m *testing.M) {
databaseIDs := []string{DefaultDatabaseID}
databasesStr, ok := os.LookupEnv(envDatabases)
if ok {
databaseIDs = append(databaseIDs, strings.Split(databasesStr, ",")...)
}
type firestoreEdition int

const (
editionStandard firestoreEdition = iota // 0
editionEnterprise // 1
)

const (
envProjID = "GCLOUD_TESTS_GOLANG_FIRESTORE_PROJECT_ID"
envPrivateKey = "GCLOUD_TESTS_GOLANG_FIRESTORE_KEY"
envDatabases = "GCLOUD_TESTS_GOLANG_FIRESTORE_DATABASES"
envEnterpriseDatabases = "GCLOUD_TESTS_GOLANG_FIRESTORE_ENTERPRISE_DATABASES"
envEmulator = "FIRESTORE_EMULATOR_HOST"
indexBuilding = "index is currently building"
databaseIDKey = "databaseID"
firestoreEditionKey = "edition"
)

func TestMain(m *testing.M) {
testParams = make(map[string]interface{})
for _, databaseID := range databaseIDs {
testParams["databaseID"] = databaseID
for databaseID, edition := range parseDatabases() {
testParams[databaseIDKey] = databaseID
testParams[firestoreEditionKey] = edition
initIntegrationTest()
status := m.Run()
if status != 0 {
Expand All @@ -68,13 +81,26 @@ func TestMain(m *testing.M) {
os.Exit(0)
}

const (
envProjID = "GCLOUD_TESTS_GOLANG_FIRESTORE_PROJECT_ID"
envPrivateKey = "GCLOUD_TESTS_GOLANG_FIRESTORE_KEY"
envDatabases = "GCLOUD_TESTS_GOLANG_FIRESTORE_DATABASES"
envEmulator = "FIRESTORE_EMULATOR_HOST"
indexBuilding = "index is currently building"
)
func parseDatabases() map[string]firestoreEdition {
databases := map[string]firestoreEdition{
DefaultDatabaseID: editionStandard,
}

databasesStr, ok := os.LookupEnv(envDatabases)
if ok {
for _, databaseID := range strings.Split(databasesStr, ",") {
databases[databaseID] = editionStandard
}
}

databasesStr, ok = os.LookupEnv(envEnterpriseDatabases)
if ok {
for _, databaseID := range strings.Split(databasesStr, ",") {
databases[databaseID] = editionEnterprise
}
}
return databases
}

var (
iClient *Client
Expand All @@ -88,7 +114,7 @@ var (
)

func initIntegrationTest() {
databaseID := testParams["databaseID"].(string)
databaseID := testParams[databaseIDKey].(string)
log.Printf("Setting up tests to run on databaseID: %q\n", databaseID)
flag.Parse() // needed for testing.Short()
if testing.Short() {
Expand Down Expand Up @@ -2730,12 +2756,12 @@ func TestIntegration_NewClientWithDatabase(t *testing.T) {
}{
{
desc: "Success",
dbName: testParams["databaseID"].(string),
dbName: testParams[databaseIDKey].(string),
wantErr: false,
},
{
desc: "Error from NewClient bubbled to NewClientWithDatabase",
dbName: testParams["databaseID"].(string),
dbName: testParams[databaseIDKey].(string),
wantErr: true,
opt: []option.ClientOption{option.WithCredentialsFile("non existent filepath")},
},
Expand Down
Loading
Loading