Last active
October 12, 2022 06:57
-
-
Save nidhi-canopas/d19682c40eb05740199b837a9ee8c614 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
type UserScore struct { | |
Score int `json:"score"` | |
} | |
// get database reference to user score | |
ref := client.NewRef("user_scores/1") | |
// read from user_scores using ref | |
var s UserScore | |
if err := ref.Get(context.TODO(), &s); err != nil { | |
log.Fatalln("error in reading from firebase DB: ", err) | |
} | |
fmt.Println("retrieved user's score is: ", s.Score) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment