I have an app that queries users from the Google Datastore using endpoints.
func getAllUsers(){
let query = GTLQueryUser.queryForUserList()
service.executeQuery(query, completionHandler: {(ticket, response, error) -> Void in
if error != nil {
print(error)
}
else{
let userCollection = response as! GTLUserCollection
if let newUsers = userCollection.items() as? [GTLUserUser]{
users = newUsers
print("The users.count = %@", users.count)
}
}
})
}
This will query all of the users as well as put them into an array of GTLUserUser since i am querying a User model.
What I am trying to do is an OR query using endpoints. What I want to do is enter two or three names and get a query back of all of the entities with those names. I have successfully completed an Or query in Python through my app. I made a GET request and passed in two names through a params dictionary. I took those two names and did an OR query. Like so:
class QueryMatches(webapp2.RequestHandler):
def get(self):
get_values = self.request.GET.getall('matchesToQuery')
r = User.query(User.user_bucket.IN(get_values))
for j in r.fetch():
print j.first_name
print j.email
This successfully queries the two users from the data store and print their names and emails. How do i do this using the endpoints on iOS. I can specify the name os the bucket.
query.userBucket = "bucketname"
However it will only take in one string and will only return one user into the array.
How do I query more than one user through the endpoints?
OR
How do I return my successful query in my Python the same way the Google Endpoints return their queries as an array of [GTLUserUser]?
Aucun commentaire:
Enregistrer un commentaire