2016-06-25 41 views
0

這是我的查詢將返回我的所有用戶在數據存儲:如何在GTLQuery上設置查詢限制?

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("These are the users that are in data store") 
       for user in users{ 
        print (user.firstName) 
       } 
      } 
     } 
    }) 
} 

如何設置查詢限制到一個讓我可以在同一時間只有一個查詢用戶?

回答

0

您必須在您的年齡的查詢字段中指定甚至可以輸入限制。像這樣:

@User.query_method(path="user/list", http_method="GET", name="user.list", query_fields=("limit", "user_bucket", "age","gender", "order", "pageToken")) 

然後你生成產生谷歌的發現客戶端代碼,那麼你可以進入迅速應用和類型:

query.limit = 1