Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(gae): migrate region tags from projectionqueries.go #5108

Conversation

OremGLG
Copy link
Contributor

@OremGLG OremGLG commented Jan 24, 2025

Description

Migrate regions by adding "gae_datastore" prefix to regions from file docs/appengine/datastore/projectionqueries/projectionqueries.go

Fixes
b/392146363
b/392145933
b/392146306
b/391185644
b/391186679

Note: Before submitting a pull request, please open an issue for discussion if you are not associated with Google.

Checklist

  • I have followed Contributing Guidelines from CONTRIBUTING.MD
  • Tests pass: go test -v ./.. (see Testing)
  • Code formatted: gofmt (see Formatting)
  • Vetting pass: go vet (see Formatting)
  • These samples need a new API enabled in testing projects to pass (let us know which ones)
  • These samples need a new/updated env vars in testing projects set to pass (let us know which ones)
  • This sample adds a new sample directory, and I updated the CODEOWNERS file with the codeowners for this sample
  • This sample adds a new Product API, and I updated the Blunderbuss issue/PR auto-assigner with the codeowners for this sample
  • Please merge this PR for me once it is approved

@product-auto-label product-auto-label bot added the samples Issues that are directly related to samples. label Jan 24, 2025
Copy link

@code-review-assist code-review-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @OremGLG and reviewers,

I'm Gemini, and I'm currently reviewing this pull request. In the meantime, I'm providing a summary of the changes for you and other reviewers to quickly get up to speed.

This pull request, "chore(gae): migrate region tags from projectionqueries.go", aims to migrate region tags by adding the prefix gae_datastore to regions within the file docs/appengine/datastore/projectionqueries/projectionqueries.go. This addresses several issues: b/392146363, b/392145933, b/392146306, b/391185644, and b/391186679.

Here's a summary of the changes:

  • File Modified: docs/appengine/datastore/projectionqueries/projectionqueries.go
  • Changes: The primary change involves adding gae_datastore as a prefix to several code comments. Specifically, the comments that previously started with // [START using_1], // [START using_2], // [START grouping], // [START projections_and_multiple_valued_properties_1], and // [START projections_and_multiple_valued_properties_2] now have the gae_datastore prefix added, resulting in comments like // [START gae_datastore_using_1], // [START gae_datastore_using_2], etc. This is consistent across the [START] and [END] markers for each section.

For example, lines 31-35 changed from:

31:	// [START using_1]
32:	q := datastore.NewQuery("People").Project("FirstName", "LastName")
33:	// [END using_1]
34:	_ = q
35:}

to:

31:	// [START gae_datastore_using_1]
32:	// [START using_1]
33:	q := datastore.NewQuery("People").Project("FirstName", "LastName")
34:	// [END using_1]
35:	// [END gae_datastore_using_1]

Similar changes were made for other sections in the file.

I'll be providing a more detailed review shortly.


A little code-review haiku for your enjoyment:

Prefixes neatly placed,
Clarity shines, bugs disappear,
Code's song now sings true.

Copy link

@code-review-assist code-review-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This pull request migrates region tags by adding the "gae_datastore" prefix to the regions in projectionqueries.go. This change clarifies the region tags and improves consistency. The changes are well-implemented and straightforward. The updated region tags accurately reflect the code snippets they enclose.

I have the following minor suggestions based on the Effective Go guidelines:

Comment on lines +31 to +35
// [START gae_datastore_using_1]
// [START using_1]
q := datastore.NewQuery("People").Project("FirstName", "LastName")
// [END using_1]
// [END gae_datastore_using_1]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

low

Can we consolidate the start and end tags for gae_datastore_using_1 and using_1 into a single tag? This would reduce redundancy and improve readability. For example:

// [START gae_datastore_using_1]
q := datastore.NewQuery("People").Project("FirstName", "LastName")
// [END gae_datastore_using_1]
Suggested change
// [START gae_datastore_using_1]
// [START using_1]
q := datastore.NewQuery("People").Project("FirstName", "LastName")
// [END using_1]
// [END gae_datastore_using_1]
// [START gae_datastore_using_1]
q := datastore.NewQuery("People").Project("FirstName", "LastName")
// [END gae_datastore_using_1]

Comment on lines +63 to +70
// [START gae_grouping_grouping]
// [START grouping]
q := datastore.NewQuery("Person").
Project("LastName", "Height").Distinct().
Filter("Height >", 20).
Order("-Height").Order("LastName")
// [END grouping]
// [END gae_grouping_grouping]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

low

The region tags gae_grouping_grouping and grouping seem redundant. It's best to avoid redundant tags and use a single, descriptive tag. Consider using just gae_datastore_grouping to ensure consistency with other examples. For example:

// [START gae_datastore_grouping]
q := datastore.NewQuery("Person").
Project("LastName", "Height").Distinct().
Filter("Height >", 20).
Order("-Height").Order("LastName")
// [END gae_datastore_grouping]
Suggested change
// [START gae_grouping_grouping]
// [START grouping]
q := datastore.NewQuery("Person").
Project("LastName", "Height").Distinct().
Filter("Height >", 20).
Order("-Height").Order("LastName")
// [END grouping]
// [END gae_grouping_grouping]
// [START gae_datastore_grouping]
q := datastore.NewQuery("Person").
Project("LastName", "Height").Distinct().
Filter("Height >", 20).
Order("-Height").Order("LastName")
// [END gae_datastore_grouping]

Comment on lines +78 to +82
// [START gae_datastore_projections_and_multiple_valued_properties_1]
// [START projections_and_multiple_valued_properties_1]
entity := Foo{A: []int{1, 1, 2, 3}, B: []string{"x", "y", "x"}}
// [END projections_and_multiple_valued_properties_1]
// [END gae_datastore_projections_and_multiple_valued_properties_1]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

low

Can we consolidate the region tags here as well, similar to the previous suggestions? Using a single tag gae_datastore_projections_and_multiple_valued_properties_1 would improve consistency and reduce redundancy. For example:

// [START gae_datastore_projections_and_multiple_valued_properties_1]
entity := Foo{A: []int{1, 1, 2, 3}, B: []string{"x", "y", "x"}}
// [END gae_datastore_projections_and_multiple_valued_properties_1]
Suggested change
// [START gae_datastore_projections_and_multiple_valued_properties_1]
// [START projections_and_multiple_valued_properties_1]
entity := Foo{A: []int{1, 1, 2, 3}, B: []string{"x", "y", "x"}}
// [END projections_and_multiple_valued_properties_1]
// [END gae_datastore_projections_and_multiple_valued_properties_1]
// [START gae_datastore_projections_and_multiple_valued_properties_1]
entity := Foo{A: []int{1, 1, 2, 3}, B: []string{"x", "y", "x"}}
// [END gae_datastore_projections_and_multiple_valued_properties_1]

Comment on lines +87 to +91
// [START gae_datastore_projections_and_multiple_valued_properties_2]
// [START projections_and_multiple_valued_properties_2]
q := datastore.NewQuery("Foo").Project("A", "B").Filter("A <", 3)
// [END projections_and_multiple_valued_properties_2]
// [END gae_datastore_projections_and_multiple_valued_properties_2]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

low

For consistency, let's consolidate the tags gae_datastore_projections_and_multiple_valued_properties_2 and projections_and_multiple_valued_properties_2 into a single tag gae_datastore_projections_and_multiple_valued_properties_2. For example:

// [START gae_datastore_projections_and_multiple_valued_properties_2]
q := datastore.NewQuery("Foo").Project("A", "B").Filter("A <", 3)
// [END gae_datastore_projections_and_multiple_valued_properties_2]
Suggested change
// [START gae_datastore_projections_and_multiple_valued_properties_2]
// [START projections_and_multiple_valued_properties_2]
q := datastore.NewQuery("Foo").Project("A", "B").Filter("A <", 3)
// [END projections_and_multiple_valued_properties_2]
// [END gae_datastore_projections_and_multiple_valued_properties_2]
// [START gae_datastore_projections_and_multiple_valued_properties_2]
q := datastore.NewQuery("Foo").Project("A", "B").Filter("A <", 3)
// [END gae_datastore_projections_and_multiple_valued_properties_2]

@OremGLG OremGLG marked this pull request as ready for review January 27, 2025 16:14
@OremGLG OremGLG requested review from a team as code owners January 27, 2025 16:14
Copy link

snippet-bot bot commented Jan 27, 2025

Here is the summary of changes.

You are about to add 5 region tags.

This comment is generated by snippet-bot.
If you find problems with this result, please file an issue at:
https://github.com/googleapis/repo-automation-bots/issues.
To update this comment, add snippet-bot:force-run label or use the checkbox below:

  • Refresh this comment

@telpirion telpirion self-assigned this Jan 28, 2025
@telpirion telpirion enabled auto-merge (squash) January 30, 2025 18:20
@telpirion telpirion merged commit 3d22ecd into GoogleCloudPlatform:main Jan 30, 2025
8 checks passed
@OremGLG OremGLG deleted the garciadiaz-chore-migrate-region-projection-queries branch January 30, 2025 19:41
@OremGLG OremGLG restored the garciadiaz-chore-migrate-region-projection-queries branch January 31, 2025 17:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
samples Issues that are directly related to samples.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants