I have a project to implement Golang integration with Firebase. The goal sounds pretty simple: I want to count how many objects in database that meet the condition (for this example if the location is in POOL XYZ and time_out is 0) and return it with format like this:
pool XYZ,n
Where poolXYZ is from the Location and n is number(s) of the objects
This is my JSON Firebase structure example (for testing)
"vehicles" : {
"VB201" : {
"register" : "VB201",
"police_number" : "",
"position" : {
"content" : {
"location" : "POOL XYZ",
"stat" : 0,
"time_in" : 1555331615429,
"time_out" : 0,
"username" : "POOL XYZ1"
}
},
"trips" : {
"content" : {
"accept" : "POOL XYZ",
"stat" : 1,
"status" : 0,
"time_stop" : 1555331615429,
"username" : "POOL XYZ1"
}
}
}
}
}
The things that i want to do is get the "register" of the vehicle, VB201, cause it meet the condition (POOL XYZ and time_out 0). There're several objects like this and has same JSON structure. SO the result might be
POOL XYZ, 1