Created
March 11, 2018 19:38
-
-
Save hiranya911/f601b951168c445932443b470f8976f0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ctx := context.Background() | |
config := &firebase.Config{ | |
DatabaseURL: "https://database-name.firebaseio.com", | |
} | |
app, err := firebase.NewApp(ctx, config) | |
if err != nil { | |
log.Fatal(err) | |
} | |
client, err := app.Database(ctx) | |
if err != nil { | |
log.Fatal(err) | |
} | |
acc := Account{ | |
Name: "Alice", | |
Balance: 1000, | |
} | |
if err := client.NewRef("accounts/alice").Set(ctx, acc); err != nil { | |
log.Fatal(err) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment