Database structure:
user json:
{
"-KbF1E26gjZCjPnfcOmi" : {
"DateOfCreation" : 1485253960222,
"EmailId" : "abc@gmail.com",
"FirstName" : "abcd",
"LastName" : "z z",
"Status" : "active",
"UserType" : "admin"
}
}
How to retrieve whole data corresponding to this key(-KbF1E26gjZCjPnfcOmi)
I have tried this code, but it is not working.
func (m *User) RetrieveFromDBId(ctx context.Context,key string)(bool) {
dB, err := GetFirebaseClient(ctx,"")
var s []string
err = dB.Child("User").Child(key).Value(s)
if err != nil {
log.Fatal(err)
return false
}
log.Println( s)
return true
}