Для проекта я использую Datastore Google App Engine с PHP, у которого нет официальной документации.GAE PHP Datastore Query
Я использовал следующее руководство, чтобы успешно добавлять новые объекты в хранилище данных, но теперь я изо всех сил стараюсь получить запросы, чтобы я мог получать данные и отображать их на своей веб-странице. https://gae-php-tips.appspot.com/2013/12/23/getting-started-with-the-cloud-datastore-on-php-app-engine/
Вот мой текущий код:
try {
// test the config and connectivity by creating a test entity, building
// a commit request for that entity, and creating/updating it in the datastore
// $req = createRequest();
// $service_dataset->commit($dataset_id, $req, []);
$req = createQuery();
// printQueryResults($req);
}
catch (Google_Exception $ex) {
syslog(LOG_WARNING, 'Commit to Cloud Datastore exception: ' . $ex->getMessage());
echo "There was an issue -- check the logs.";
return;
}
function createQuery()
{
$gql_query = new Google_Service_Datastore_GqlQuery();
$gql_query->setQueryString("SELECT * FROM 'Notes' WHERE name = 'test1'");
$gql_query->setAllowLiteral(true);
$req = new Google_Service_Datastore_RunQueryRequest();
$req->setGqlQuery($gql_query);
return $req;
}
Я хочу, чтобы иметь возможность запрашивать мой хранилищу и получить все объекты, которые имеют совпадающее имя.