Skip to content

Commit a291d33

Browse files
committed
Merge branch 'dev'
2 parents 10442ce + 255e5ed commit a291d33

File tree

4 files changed

+24
-6
lines changed

4 files changed

+24
-6
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Unreleased
22

3+
# v3.4.0
4+
5+
- [added] `firebase.App` now provides a new `DatabaseWithURL()` function
6+
for initializing a database client from a URL.
7+
38
# v3.3.0
49

510
- [fixed] Fixing a regression introduced in 3.2.0, where `VerifyIDToken()`

firebase.go

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ import (
4242
var defaultAuthOverrides = make(map[string]interface{})
4343

4444
// Version of the Firebase Go Admin SDK.
45-
const Version = "3.3.0"
45+
const Version = "3.4.0"
4646

4747
// firebaseEnvName is the name of the environment variable with the Config.
4848
const firebaseEnvName = "FIREBASE_CONFIG"
@@ -79,11 +79,18 @@ func (a *App) Auth(ctx context.Context) (*auth.Client, error) {
7979
return auth.NewClient(ctx, conf)
8080
}
8181

82-
// Database returns an instance of db.Client.
82+
// Database returns an instance of db.Client to interact with the default Firebase Database
83+
// configured via Config.DatabaseURL.
8384
func (a *App) Database(ctx context.Context) (*db.Client, error) {
85+
return a.DatabaseWithURL(ctx, a.dbURL)
86+
}
87+
88+
// DatabaseWithURL returns an instance of db.Client to interact with the Firebase Database
89+
// identified by the given URL.
90+
func (a *App) DatabaseWithURL(ctx context.Context, url string) (*db.Client, error) {
8491
conf := &internal.DatabaseConfig{
8592
AuthOverride: a.authOverride,
86-
URL: a.dbURL,
93+
URL: url,
8794
Opts: a.opts,
8895
Version: Version,
8996
}

firebase_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,10 @@ func TestDatabase(t *testing.T) {
246246
if c, err := app.Database(ctx); c == nil || err != nil {
247247
t.Errorf("Database() = (%v, %v); want (db, nil)", c, err)
248248
}
249+
url := "https://other-mock-db.firebaseio.com"
250+
if c, err := app.DatabaseWithURL(ctx, url); c == nil || err != nil {
251+
t.Errorf("Database() = (%v, %v); want (db, nil)", c, err)
252+
}
249253
}
250254

251255
func TestDatabaseAuthOverrides(t *testing.T) {

iid/iid.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,10 +131,12 @@ func NewClient(ctx context.Context, c *internal.InstanceIDConfig) (*Client, erro
131131
}, nil
132132
}
133133

134-
// DeleteInstanceID deletes an instance ID from Firebase.
134+
// DeleteInstanceID deletes the specified instance ID and the associated data from Firebase..
135135
//
136-
// This can be used to delete an instance ID and associated user data from a Firebase project,
137-
// pursuant to the General Data protection Regulation (GDPR).
136+
// Note that Google Analytics for Firebase uses its own form of Instance ID to keep track of
137+
// analytics data. Therefore deleting a regular instance ID does not delete Analytics data.
138+
// See https://firebase.google.com/support/privacy/manage-iids#delete_an_instance_id for
139+
// more information.
138140
func (c *Client) DeleteInstanceID(ctx context.Context, iid string) error {
139141
if iid == "" {
140142
return errors.New("instance id must not be empty")

0 commit comments

Comments
 (0)