Skip to content

Commit

Permalink
fix(gae): delete old region tags (#5102)
Browse files Browse the repository at this point in the history
Co-authored-by: Jennifer Davis <sigje@google.com>
  • Loading branch information
OremGLG and iennae authored Jan 26, 2025
1 parent 7fd711d commit e3276e0
Showing 1 changed file with 0 additions and 16 deletions.
16 changes: 0 additions & 16 deletions docs/appengine/datastore/entities/entities.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ type Address struct{}

func example() {
// [START gae_datastore_batch]
// [START batch]
// A batch put.
_, err = datastore.PutMulti(ctx, []*datastore.Key{k1, k2, k3}, []interface{}{e1, e2, e3})

Expand All @@ -41,46 +40,38 @@ func example() {

// A batch delete.
err = datastore.DeleteMulti(ctx, []*datastore.Key{k1, k2, k3})
// [END batch]
// [END gae_datastore_batch]
_ = err
}

func example2() {
// [START gae_datastore_delete]
// [START delete]
key := datastore.NewKey(ctx, "Employee", "asalieri", 0, nil)
err = datastore.Delete(ctx, key)
// [END delete]
// [END gae_datastore_delete]
}

func example3() {
// [START gae_datastore_get_key]
// [START get_key]
employeeKey := datastore.NewKey(ctx, "Employee", "asalieri", 0, nil)
addressKey := datastore.NewKey(ctx, "Address", "", 1, employeeKey)
var addr Address
err = datastore.Get(ctx, addressKey, &addr)
// [END get_key]
// [END gae_datastore_get_key]
}

func example4() {
// [START gae_datastore_key_id]
// [START key_id]
// Create a key such as Employee:8261.
key := datastore.NewKey(ctx, "Employee", "", 0, nil)
// This is equivalent:
key = datastore.NewIncompleteKey(ctx, "Employee", nil)
// [END key_id]
// [END gae_datastore_key_id]
_ = key
}

func example5() {
// [START gae_datastore_key_name]
// [START key_name]
// Create a key with a key name "asalieri".
key := datastore.NewKey(
ctx, // context.Context
Expand All @@ -89,14 +80,12 @@ func example5() {
0, // Integer ID; if 0, generate automatically. Ignored if string ID specified.
nil, // Parent Key; nil means no parent
)
// [END key_name]
// [END gae_datastore_key_name]
_ = key
}

func example6() {
// [START gae_datastore_parent]
// [START parent]
// Create Employee entity
employee := &Employee{ /* ... */ }
employeeKey, err := datastore.Put(ctx, datastore.NewIncompleteKey(ctx, "Employee", nil), employee)
Expand All @@ -106,14 +95,12 @@ func example6() {
address := &Address{ /* ... */ }
addressKey := datastore.NewIncompleteKey(ctx, "Address", employeeKey)
_, err = datastore.Put(ctx, addressKey, address)
// [END parent]
// [END gae_datastore_parent]
_ = err
}

func example7() {
// [START gae_datastore_put_with_keyname]
// [START put_with_keyname]
employee := &Employee{
FirstName: "Antonio",
LastName: "Salieri",
Expand All @@ -122,13 +109,11 @@ func example7() {
employee.AttendedHRTraining = true
key := datastore.NewKey(ctx, "Employee", "asalieri", 0, nil)
_, err = datastore.Put(ctx, key, employee)
// [END put_with_keyname]
// [END gae_datastore_put_with_keyname]
}

func example8() {
// [START gae_datastore_put_without_keyname]
// [START put_without_keyname]
employee := &Employee{
FirstName: "Antonio",
LastName: "Salieri",
Expand All @@ -137,6 +122,5 @@ func example8() {
employee.AttendedHRTraining = true
key := datastore.NewIncompleteKey(ctx, "Employee", nil)
_, err = datastore.Put(ctx, key, employee)
// [END put_without_keyname]
// [END gae_datastore_put_without_keyname]
}

0 comments on commit e3276e0

Please sign in to comment.