コード例 #1
0
 /**
  * Creates a query object for pulling the last $limit number of
  * "PubSubMessage" items, equivalent to the following GQL:
  *
  *    SELECT * from DatastoreComment ORDER BY created DESC LIMIT 20
  *
  * @see https://cloud.google.com/datastore/docs/concepts/gql
  */
 public function createSimpleQuery($limit = 20)
 {
     $request = new \Google_Service_Datastore_RunQueryRequest();
     $query = new \Google_Service_Datastore_Query();
     $order = new \Google_Service_Datastore_PropertyOrder();
     $order->setDirection('descending');
     $property = new \Google_Service_Datastore_PropertyReference();
     $property->setName('created');
     $order->setProperty($property);
     $query->setOrder([$order]);
     $kind = new \Google_Service_Datastore_KindExpression();
     $kind->setName(self::KIND);
     $query->setKinds([$kind]);
     $query->setLimit($limit);
     $request->setQuery($query);
     return $request;
 }
コード例 #2
0
 /**
  * Create a query object for the given Kind.
  */
 protected static function createQuery($kind_name)
 {
     $query = new Google_Service_Datastore_Query();
     $kind = new Google_Service_Datastore_KindExpression();
     $kind->setName($kind_name);
     $query->setKinds([$kind]);
     return $query;
 }
コード例 #3
0
 /**
  * @param string $kindName
  * @return \Google_Service_Datastore_KindExpression
  */
 public static function newKindExpression($kindName)
 {
     $kind = new \Google_Service_Datastore_KindExpression();
     $kind->setName($kindName);
     return $kind;
 }