├── .gitattributes
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── LICENSE
├── README.md
├── SECURITY.md
├── VERSION
├── composer.json
├── metadata
└── V1
│ ├── AggregationResult.php
│ ├── Datastore.php
│ ├── Entity.php
│ ├── Query.php
│ └── QueryProfile.php
└── src
├── Blob.php
├── Connection
├── ConnectionInterface.php
├── Grpc.php
├── Rest.php
└── ServiceDefinition
│ └── datastore-v1.json
├── Cursor.php
├── DatastoreClient.php
├── DatastoreSessionHandler.php
├── DatastoreTrait.php
├── Entity.php
├── EntityInterface.php
├── EntityIterator.php
├── EntityMapper.php
├── EntityOptionsTrait.php
├── EntityPageIterator.php
├── EntityTrait.php
├── GeoPoint.php
├── Key.php
├── Operation.php
├── Query
├── Aggregation.php
├── AggregationQuery.php
├── AggregationQueryResult.php
├── Filter.php
├── GqlQuery.php
├── Query.php
└── QueryInterface.php
├── ReadOnlyTransaction.php
├── Transaction.php
├── TransactionTrait.php
└── V1
├── AggregationQuery.php
├── AggregationQuery
├── Aggregation.php
└── Aggregation
│ ├── Avg.php
│ ├── Count.php
│ └── Sum.php
├── AggregationQuery_Aggregation.php
├── AggregationQuery_Aggregation_Count.php
├── AggregationResult.php
├── AggregationResultBatch.php
├── AllocateIdsRequest.php
├── AllocateIdsResponse.php
├── ArrayValue.php
├── BeginTransactionRequest.php
├── BeginTransactionResponse.php
├── Client
└── DatastoreClient.php
├── CommitRequest.php
├── CommitRequest
└── Mode.php
├── CommitRequest_Mode.php
├── CommitResponse.php
├── CompositeFilter.php
├── CompositeFilter
└── Operator.php
├── CompositeFilter_Operator.php
├── DatastoreClient.php
├── DatastoreGrpcClient.php
├── Entity.php
├── EntityResult.php
├── EntityResult
└── ResultType.php
├── EntityResult_ResultType.php
├── ExecutionStats.php
├── ExplainMetrics.php
├── ExplainOptions.php
├── Filter.php
├── FindNearest.php
├── FindNearest
└── DistanceMeasure.php
├── Gapic
└── DatastoreGapicClient.php
├── GqlQuery.php
├── GqlQueryParameter.php
├── Key.php
├── Key
└── PathElement.php
├── Key_PathElement.php
├── KindExpression.php
├── LookupRequest.php
├── LookupResponse.php
├── Mutation.php
├── Mutation
└── ConflictResolutionStrategy.php
├── MutationResult.php
├── PartitionId.php
├── PlanSummary.php
├── Projection.php
├── PropertyFilter.php
├── PropertyFilter
└── Operator.php
├── PropertyFilter_Operator.php
├── PropertyMask.php
├── PropertyOrder.php
├── PropertyOrder
└── Direction.php
├── PropertyOrder_Direction.php
├── PropertyReference.php
├── PropertyTransform.php
├── PropertyTransform
└── ServerValue.php
├── Query.php
├── QueryMode.php
├── QueryPlan.php
├── QueryResultBatch.php
├── QueryResultBatch
└── MoreResultsType.php
├── QueryResultBatch_MoreResultsType.php
├── README.md
├── ReadOptions.php
├── ReadOptions
└── ReadConsistency.php
├── ReadOptions_ReadConsistency.php
├── ReserveIdsRequest.php
├── ReserveIdsResponse.php
├── ResultSetStats.php
├── RollbackRequest.php
├── RollbackResponse.php
├── RunAggregationQueryRequest.php
├── RunAggregationQueryResponse.php
├── RunQueryRequest.php
├── RunQueryResponse.php
├── TransactionOptions.php
├── TransactionOptions
├── PBReadOnly.php
├── ReadOnly.php
└── ReadWrite.php
├── TransactionOptions_ReadOnly.php
├── TransactionOptions_ReadWrite.php
├── Value.php
└── resources
├── datastore_client_config.json
├── datastore_descriptor_config.php
└── datastore_rest_client_config.php
/.gitattributes:
--------------------------------------------------------------------------------
1 | /*.xml.dist export-ignore
2 | /tests export-ignore
3 | /.github export-ignore
4 | /samples export-ignore
5 | /.OwlBot.yaml export-ignore
6 | /owlbot.py export-ignore
7 | /src/**/gapic_metadata.json export-ignore
8 |
--------------------------------------------------------------------------------
/CODE_OF_CONDUCT.md:
--------------------------------------------------------------------------------
1 | # Contributor Code of Conduct
2 |
3 | As contributors and maintainers of this project,
4 | and in the interest of fostering an open and welcoming community,
5 | we pledge to respect all people who contribute through reporting issues,
6 | posting feature requests, updating documentation,
7 | submitting pull requests or patches, and other activities.
8 |
9 | We are committed to making participation in this project
10 | a harassment-free experience for everyone,
11 | regardless of level of experience, gender, gender identity and expression,
12 | sexual orientation, disability, personal appearance,
13 | body size, race, ethnicity, age, religion, or nationality.
14 |
15 | Examples of unacceptable behavior by participants include:
16 |
17 | * The use of sexualized language or imagery
18 | * Personal attacks
19 | * Trolling or insulting/derogatory comments
20 | * Public or private harassment
21 | * Publishing other's private information,
22 | such as physical or electronic
23 | addresses, without explicit permission
24 | * Other unethical or unprofessional conduct.
25 |
26 | Project maintainers have the right and responsibility to remove, edit, or reject
27 | comments, commits, code, wiki edits, issues, and other contributions
28 | that are not aligned to this Code of Conduct.
29 | By adopting this Code of Conduct,
30 | project maintainers commit themselves to fairly and consistently
31 | applying these principles to every aspect of managing this project.
32 | Project maintainers who do not follow or enforce the Code of Conduct
33 | may be permanently removed from the project team.
34 |
35 | This code of conduct applies both within project spaces and in public spaces
36 | when an individual is representing the project or its community.
37 |
38 | Instances of abusive, harassing, or otherwise unacceptable behavior
39 | may be reported by opening an issue
40 | or contacting one or more of the project maintainers.
41 |
42 | This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.2.0,
43 | available at [http://contributor-covenant.org/version/1/2/0/](http://contributor-covenant.org/version/1/2/0/)
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | # How to Contribute
2 |
3 | We'd love to accept your patches and contributions to this project. We accept
4 | and review pull requests against the main
5 | [Google Cloud PHP](https://github.com/googleapis/google-cloud-php)
6 | repository, which contains all of our client libraries. You will also need to
7 | sign a Contributor License Agreement. For more details about how to contribute,
8 | see the
9 | [CONTRIBUTING.md](https://github.com/googleapis/google-cloud-php/blob/main/CONTRIBUTING.md)
10 | file in the main Google Cloud PHP repository.
11 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Google Cloud PHP Datastore
2 |
3 | > Idiomatic PHP client for [Cloud Datastore](https://cloud.google.com/datastore/).
4 |
5 | [](https://packagist.org/packages/google/cloud-datastore) [](https://packagist.org/packages/google/cloud-datastore)
6 |
7 | * [API documentation](https://cloud.google.com/php/docs/reference/cloud-datastore/latest)
8 |
9 | **NOTE:** This repository is part of [Google Cloud PHP](https://github.com/googleapis/google-cloud-php). Any
10 | support requests, bug reports, or development contributions should be directed to
11 | that project.
12 |
13 | A NoSQL document database built for automatic scaling, high performance, and
14 | ease of application development. While the Cloud Datastore interface has many of
15 | the same features as traditional databases, as a NoSQL database it differs from
16 | them in the way it describes relationships between data objects.
17 |
18 | ### Installation
19 |
20 | To begin, install the preferred dependency manager for PHP, [Composer](https://getcomposer.org/).
21 |
22 | Now install this component:
23 |
24 | ```sh
25 | $ composer require google/cloud-datastore
26 | ```
27 |
28 | ### Authentication
29 |
30 | Please see our [Authentication guide](https://github.com/googleapis/google-cloud-php/blob/main/AUTHENTICATION.md) for more information
31 | on authenticating your client. Once authenticated, you'll be ready to start making requests.
32 |
33 | ### Sample
34 |
35 | ```php
36 | require 'vendor/autoload.php';
37 |
38 | use Google\Cloud\Datastore\DatastoreClient;
39 |
40 | $datastore = new DatastoreClient();
41 |
42 | // Create an entity
43 | $bob = $datastore->entity('Person');
44 | $bob['firstName'] = 'Bob';
45 | $bob['email'] = 'bob@example.com';
46 | $datastore->insert($bob);
47 |
48 | // Update the entity
49 | $bob['email'] = 'bobV2@example.com';
50 | $datastore->update($bob);
51 |
52 | // If you know the ID of the entity, you can look it up
53 | $key = $datastore->key('Person', '12345328897844');
54 | $entity = $datastore->lookup($key);
55 | ```
56 |
57 | ### Debugging
58 |
59 | Please see our [Debugging guide](https://github.com/googleapis/google-cloud-php/blob/main/DEBUG.md)
60 | for more information about the debugging tools.
61 |
62 | ### Version
63 |
64 | This component is considered GA (generally available). As such, it will not introduce backwards-incompatible changes in
65 | any minor or patch releases. We will address issues and requests with the highest priority.
66 |
67 | ### Compatibility with Google App Engine
68 |
69 | This component is compatible with PHP projects on Google App Engine in the Standard or Flexible environments. To maximize the performance of datastore operations in your app, we recommend the following configuration:
70 | 1. PHP 7 runtime
71 | 2. Enable grpc.so and protobuf.so in your php.ini file
72 | 3. Set your DatastoreClient object's 'transport' option to 'grpc'
73 |
74 | You are likely to experience less optimal datastore performance using the PHP 5 runtime on App Engine standard due to the lack of the protobuf extension.
75 |
76 |
77 | ### Next Steps
78 |
79 | 1. Understand the [official documentation](https://cloud.google.com/datastore/docs/).
80 | 2. Take a look at [in-depth usage samples](https://github.com/GoogleCloudPlatform/php-docs-samples/tree/master/datastore).
81 |
--------------------------------------------------------------------------------
/SECURITY.md:
--------------------------------------------------------------------------------
1 | # Security Policy
2 |
3 | To report a security issue, please use [g.co/vulnz](https://g.co/vulnz).
4 |
5 | The Google Security Team will respond within 5 working days of your report on g.co/vulnz.
6 |
7 | We use g.co/vulnz for our intake, and do coordination and disclosure here using GitHub Security Advisory to privately discuss and fix the issue.
--------------------------------------------------------------------------------
/VERSION:
--------------------------------------------------------------------------------
1 | 1.32.3
2 |
--------------------------------------------------------------------------------
/composer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "google/cloud-datastore",
3 | "description": "Cloud Datastore Client for PHP",
4 | "license": "Apache-2.0",
5 | "minimum-stability": "stable",
6 | "require": {
7 | "php": "^8.0",
8 | "google/cloud-core": "^1.57",
9 | "google/gax": "^1.36.0"
10 | },
11 | "require-dev": {
12 | "phpunit/phpunit": "^9.0",
13 | "phpspec/prophecy-phpunit": "^2.0",
14 | "squizlabs/php_codesniffer": "2.*",
15 | "phpdocumentor/reflection": "^5.3.3||^6.0",
16 | "phpdocumentor/reflection-docblock": "^5.3",
17 | "erusev/parsedown": "^1.6"
18 | },
19 | "extra": {
20 | "component": {
21 | "id": "cloud-datastore",
22 | "target": "googleapis/google-cloud-php-datastore.git",
23 | "path": "Datastore",
24 | "entry": "src/DatastoreClient.php"
25 | }
26 | },
27 | "autoload": {
28 | "psr-4": {
29 | "Google\\Cloud\\Datastore\\": "src",
30 | "GPBMetadata\\Google\\Datastore\\": "metadata"
31 | }
32 | },
33 | "autoload-dev": {
34 | "psr-4": {
35 | "Google\\Cloud\\Datastore\\Tests\\": "tests"
36 | }
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/metadata/V1/AggregationResult.php:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/googleapis/google-cloud-php-datastore/3947890b80051809fecf125c5be9a05821892fb6/metadata/V1/AggregationResult.php
--------------------------------------------------------------------------------
/metadata/V1/Datastore.php:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/googleapis/google-cloud-php-datastore/3947890b80051809fecf125c5be9a05821892fb6/metadata/V1/Datastore.php
--------------------------------------------------------------------------------
/metadata/V1/Entity.php:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/googleapis/google-cloud-php-datastore/3947890b80051809fecf125c5be9a05821892fb6/metadata/V1/Entity.php
--------------------------------------------------------------------------------
/metadata/V1/Query.php:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/googleapis/google-cloud-php-datastore/3947890b80051809fecf125c5be9a05821892fb6/metadata/V1/Query.php
--------------------------------------------------------------------------------
/metadata/V1/QueryProfile.php:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/googleapis/google-cloud-php-datastore/3947890b80051809fecf125c5be9a05821892fb6/metadata/V1/QueryProfile.php
--------------------------------------------------------------------------------
/src/Blob.php:
--------------------------------------------------------------------------------
1 | blob(file_get_contents(__DIR__ .'/family-photo.jpg'));
34 | * ```
35 | *
36 | * ```
37 | * // Get the value of a blob by casting to a string.
38 | *
39 | * echo (string) $blob;
40 | * ```
41 | */
42 | class Blob extends CoreBlob
43 | {
44 |
45 | }
46 |
--------------------------------------------------------------------------------
/src/Connection/ConnectionInterface.php:
--------------------------------------------------------------------------------
1 | null];
47 |
48 | $baseUri = $this->getApiEndpoint(self::BASE_URI, $config);
49 | if ((bool) $config['emulatorHost']) {
50 | // @codeCoverageIgnoreStart
51 | $baseUri = $this->emulatorBaseUri($config['emulatorHost']);
52 | $config['shouldSignRequest'] = false;
53 | // @codeCoverageIgnoreEnd
54 | }
55 |
56 | $config += [
57 | 'serviceDefinitionPath' => __DIR__ . '/ServiceDefinition/datastore-v1.json',
58 | 'componentVersion' => DatastoreClient::VERSION
59 | ];
60 |
61 | $this->setRequestWrapper(new RequestWrapper($config));
62 | $this->setRequestBuilder(new RequestBuilder(
63 | $config['serviceDefinitionPath'],
64 | $baseUri
65 | ));
66 | }
67 |
68 | /**
69 | * @param array $args
70 | * @return array
71 | */
72 | public function allocateIds(array $args)
73 | {
74 | return $this->sendWithHeaders('projects', 'allocateIds', $args);
75 | }
76 |
77 | /**
78 | * @param array $args
79 | * @return array
80 | */
81 | public function beginTransaction(array $args)
82 | {
83 | return $this->sendWithHeaders('projects', 'beginTransaction', $args);
84 | }
85 |
86 | /**
87 | * @param array $args
88 | * @return array
89 | */
90 | public function commit(array $args)
91 | {
92 | return $this->sendWithHeaders('projects', 'commit', $args);
93 | }
94 |
95 | /**
96 | * @param array $args
97 | * @return array
98 | */
99 | public function lookup(array $args)
100 | {
101 | return $this->sendWithHeaders('projects', 'lookup', $args);
102 | }
103 |
104 | /**
105 | * @param array $args
106 | * @return array
107 | */
108 | public function rollback(array $args)
109 | {
110 | return $this->sendWithHeaders('projects', 'rollback', $args);
111 | }
112 |
113 | /**
114 | * @param array $args
115 | * @return array
116 | */
117 | public function runQuery(array $args)
118 | {
119 | return $this->sendWithHeaders('projects', 'runQuery', $args);
120 | }
121 |
122 | /**
123 | * @param array $args
124 | * @return array
125 | */
126 | public function runAggregationQuery(array $args)
127 | {
128 | if (isset($args['aggregationQuery']['aggregations'])) {
129 | foreach ($args['aggregationQuery']['aggregations'] as &$aggregation) {
130 | $aggregation = array_map(
131 | fn ($item) => is_array($item) && count($item) === 0
132 | ? new \stdClass()
133 | : $item,
134 | $aggregation
135 | );
136 | }
137 | }
138 | return $this->sendWithHeaders('projects', 'runAggregationQuery', $args);
139 | }
140 |
141 | /**
142 | * Deliver the request built from serice definition.
143 | * Also apply the `x-goog-request-params` header to the request. This header
144 | * is required for operations involving a non-default databases.
145 | *
146 | * @param string $resource The resource type used for the request.
147 | * @param string $method The method used for the request.
148 | * @param array $args Options used to build out the request.
149 | */
150 | private function sendWithHeaders($resource, $method, $args)
151 | {
152 | if (isset($args['projectId']) && isset($args['databaseId'])) {
153 | $args['restOptions']['headers']['x-goog-request-params'] = sprintf(
154 | 'project_id=%s&database_id=%s',
155 | $args['projectId'],
156 | $args['databaseId']
157 | );
158 | }
159 |
160 | return $this->send($resource, $method, $args);
161 | }
162 | }
163 |
--------------------------------------------------------------------------------
/src/Cursor.php:
--------------------------------------------------------------------------------
1 | cursor($cursorValue);
32 | *
33 | * $query = $datastore->gqlQuery('SELECT * FROM Companies OFFSET @cursor', [
34 | * 'bindings' => [
35 | * 'cursor' => $cursor
36 | * ]
37 | * ]);
38 | * ```
39 | */
40 | class Cursor
41 | {
42 | /**
43 | * @var string|int
44 | */
45 | private $cursor;
46 |
47 | /**
48 | * @param string|int $cursor The cursor value.
49 | */
50 | public function __construct($cursor)
51 | {
52 | $this->cursor = $cursor;
53 | }
54 |
55 | /**
56 | * @access private
57 | * @return string|int
58 | */
59 | public function cursor()
60 | {
61 | return $this->cursor;
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/src/DatastoreTrait.php:
--------------------------------------------------------------------------------
1 | $databaseId,
37 | 'projectId' => $projectId,
38 | 'namespaceId' => $namespaceId,
39 | ]);
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/src/EntityInterface.php:
--------------------------------------------------------------------------------
1 | pageIterator, 'moreResultsType')
41 | ? $this->pageIterator->moreResultsType()
42 | : null;
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/src/EntityOptionsTrait.php:
--------------------------------------------------------------------------------
1 | cursor();
43 | * ```
44 | *
45 | * @see https://cloud.google.com/datastore/docs/reference/rest/v1/EntityResult EntityResult.cursor
46 | *
47 | * @return string|null
48 | */
49 | public function cursor()
50 | {
51 | return isset($this->options['cursor'])
52 | ? $this->options['cursor']
53 | : null;
54 | }
55 |
56 | /**
57 | * Fetch the baseVersion
58 | *
59 | * This is only set when the entity was obtained from a query result. It
60 | * is used for concurrency control internally.
61 | *
62 | * Example:
63 | * ```
64 | * $baseVersion = $entity->baseVersion();
65 | * ```
66 | *
67 | * @see https://cloud.google.com/datastore/docs/reference/rest/v1/EntityResult EntitResult.version
68 | *
69 | * @return string|null
70 | */
71 | public function baseVersion()
72 | {
73 | return isset($this->options['baseVersion'])
74 | ? $this->options['baseVersion']
75 | : null;
76 | }
77 |
78 | /**
79 | * Indicate whether the entity was created as the result of an API call.
80 | *
81 | * Example:
82 | * ```
83 | * $populatedByService = $entity->populatedByService();
84 | * ```
85 | *
86 | * @return bool
87 | */
88 | public function populatedByService()
89 | {
90 | return isset($this->options['populatedByService'])
91 | ? $this->options['populatedByService']
92 | : false;
93 | }
94 |
95 | /**
96 | * A list of entity properties to exclude from datastore indexes.
97 | *
98 | * Example:
99 | * ```
100 | * $entity['birthDate'] = new DateTime('December 31, 1969');
101 | * $entity->setExcludeFromIndexes([
102 | * 'birthDate'
103 | * ]);
104 | * ```
105 | *
106 | * @param array $properties A list of properties to exclude from indexes.
107 | * @return void
108 | */
109 | public function setExcludeFromIndexes(array $properties)
110 | {
111 | $this->options['excludeFromIndexes'] = $properties;
112 | }
113 |
114 | /**
115 | * Return a list of properties excluded from datastore indexes.
116 | *
117 | * Example:
118 | * ```
119 | * $excludedFromIndexes = $entity->excludedProperties();
120 | * ```
121 | *
122 | * @return array
123 | */
124 | public function excludedProperties()
125 | {
126 | return isset($this->options['excludeFromIndexes'])
127 | ? $this->options['excludeFromIndexes']
128 | : [];
129 | }
130 |
131 | /**
132 | * Return a list of meaning values.
133 | *
134 | * Example:
135 | * ```
136 | * $meanings = $entity->meanings();
137 | * ```
138 | *
139 | * @return array
140 | */
141 | public function meanings()
142 | {
143 | return isset($this->options['meanings'])
144 | ? $this->options['meanings']
145 | : [];
146 | }
147 | }
148 |
--------------------------------------------------------------------------------
/src/EntityPageIterator.php:
--------------------------------------------------------------------------------
1 | moreResultsType;
47 | }
48 |
49 | /**
50 | * Get the current page.
51 | *
52 | * @return array|null
53 | */
54 | #[\ReturnTypeWillChange]
55 | public function current()
56 | {
57 | if (!$this->page) {
58 | $this->page = $this->executeCall();
59 | }
60 |
61 | $this->moreResultsType = $this->page['batch']['moreResults'] ?? null;
62 |
63 | return $this->get($this->itemsPath, $this->page);
64 | }
65 | }
66 |
--------------------------------------------------------------------------------
/src/GeoPoint.php:
--------------------------------------------------------------------------------
1 | geoPoint(37.423147, -122.085015);
32 | * ```
33 | *
34 | * @see https://cloud.google.com/datastore/reference/rest/Shared.Types/LatLng LatLng
35 | */
36 | class GeoPoint extends CoreGeoPoint
37 | {
38 |
39 | }
40 |
--------------------------------------------------------------------------------
/src/Query/Aggregation.php:
--------------------------------------------------------------------------------
1 | alias('count');
27 | * $count->limit(100);
28 | *
29 | * echo json_encode($count->getProps());
30 | * ```
31 | *
32 | * Aggregations considers non existing property name as an empty query set
33 | */
34 | class Aggregation
35 | {
36 | /**
37 | * Default placeholder for all count aggregation props.
38 | */
39 | private const TYPE_COUNT = 'count';
40 |
41 | /**
42 | * Default placeholder for all sum aggregation props.
43 | */
44 | private const TYPE_SUM = 'sum';
45 |
46 | /**
47 | * Default placeholder for all average aggregation props.
48 | */
49 | private const TYPE_AVG = 'avg';
50 |
51 | /**
52 | * @var array Properties for an aggregation query.
53 | */
54 | private array $props = [];
55 |
56 | /**
57 | * @var string Holds key for aggregation type.
58 | */
59 | private $aggregationType;
60 |
61 | /**
62 | * Construct an Aggregation object.
63 | *
64 | * @param string $aggregationType
65 | */
66 | private function __construct($aggregationType)
67 | {
68 | $this->aggregationType = $aggregationType;
69 | }
70 |
71 | /**
72 | * Creates count aggregation properties.
73 | *
74 | * Example:
75 | * ```
76 | * $count = Aggregation::count();
77 | * ```
78 | * @return Aggregation
79 | */
80 | public static function count()
81 | {
82 | return self::createAggregation(self::TYPE_COUNT);
83 | }
84 |
85 | /**
86 | * Creates sum aggregation properties.
87 | *
88 | * Example:
89 | * ```
90 | * $sum = Aggregate::sum('property_to_aggregate_upon');
91 | * ```
92 | * Result of SUM aggregation can be a integer or a float.
93 | * Sum of integers which exceed maxinum integer value returns a float.
94 | * Sum of numbers exceeding max float value returns `INF`.
95 | * Sum of data which contains `NaN` returns `NaN`.
96 | * Non numeric values are ignored.
97 | *
98 | * @param string $property The relative path of the field to aggregate upon.
99 | * @return Aggregation
100 | */
101 | public static function sum($property)
102 | {
103 | return self::createAggregation(self::TYPE_SUM, $property);
104 | }
105 |
106 | /**
107 | * Creates average aggregation properties.
108 | *
109 | * Example:
110 | * ```
111 | * $avg = Aggregate::avg('property_to_aggregate_upon');
112 | * ```
113 | * Result of AVG aggregation can be a float or a null.
114 | * Average of empty valid data set return `null`.
115 | * Average of numbers exceeding max float value returns `INF`.
116 | * Average of data which contains `NaN` returns `NaN`.
117 | * Non numeric values are ignored.
118 | *
119 | * @param string $property The relative path of the field to aggregate upon.
120 | * @return Aggregation
121 | */
122 | public static function avg($property)
123 | {
124 | return self::createAggregation(self::TYPE_AVG, $property);
125 | }
126 |
127 | private static function createAggregation(string $type, $property = null)
128 | {
129 | $aggregation = new Aggregation($type);
130 | $aggregation->props[$aggregation->aggregationType] = [];
131 | if (!is_null($property)) {
132 | $aggregation->props[$aggregation->aggregationType] = [
133 | 'property' => [
134 | 'name' => $property
135 | ]
136 | ];
137 | }
138 | return $aggregation;
139 | }
140 |
141 | /**
142 | * Set the aggregation alias.
143 | *
144 | * Example:
145 | * ```
146 | * $count = Aggregation->count();
147 | * $count->alias('total');
148 | *
149 | * echo $count->props()['count']['alias'];
150 | * ```
151 | *
152 | * @param string $alias The alias for aggregation.
153 | * @return Aggregation
154 | */
155 | public function alias($alias)
156 | {
157 | $this->props['alias'] = $alias;
158 | return $this;
159 | }
160 |
161 | /**
162 | * Get the array representation for the aggregation.
163 | *
164 | * @return array
165 | */
166 | public function getProps()
167 | {
168 | return $this->props;
169 | }
170 | }
171 |
--------------------------------------------------------------------------------
/src/Query/AggregationQuery.php:
--------------------------------------------------------------------------------
1 | query();
33 | * $query->kind('Companies');
34 | * $query->filter('companyName', '=', 'Google');
35 | * $aggregationQuery = $query->aggregation(Aggregation::count()->alias('total'));
36 | *
37 | * $res = $datastore->runAggregationQuery($aggregationQuery);
38 | * echo $res->get('total');
39 | * ```
40 | *
41 | * Example (aggregated using over method):
42 | * ```
43 | * use Google\Cloud\Datastore\DatastoreClient;
44 | * use Google\Cloud\Datastore\Query\Aggregation;
45 | *
46 | * $datastore = new DatastoreClient();
47 | *
48 | * $query = $datastore->query();
49 | * $query->kind('Companies');
50 | * $query->filter('companyName', '=', 'Google');
51 | * $query->limit(100);
52 | * $aggregationQuery = $datastore->aggregationQuery();
53 | * $aggregationQuery->over($query)->addAggregation(Aggregation::count()->alias('total_upto_100'));
54 | *
55 | * $res = $datastore->runAggregationQuery($aggregationQuery);
56 | * echo $res->get('total_upto_100');
57 | * ```
58 | *
59 | * @see https://cloud.google.com/datastore/reference/rest/v1/projects/runAggregationQuery#query
60 | * Aggregation Query Object Reference
61 | * @see https://cloud.google.com/datastore/docs/aggregation-queries Aggregation Queries
62 | */
63 | class AggregationQuery
64 | {
65 | /**
66 | * @var QueryInterface|null
67 | */
68 | private $query;
69 |
70 | /**
71 | * @var array
72 | */
73 | private array $aggregates = [];
74 |
75 | /**
76 | * Create an aggregation query.
77 | *
78 | * @param QueryInterface|null $query
79 | */
80 | public function __construct($query = null, $aggregates = [])
81 | {
82 | $this->query = $query;
83 | $this->aggregates = $aggregates;
84 | }
85 |
86 | /**
87 | * Adds a Query Aggregation.
88 | *
89 | * Accepts an array of properties for aggregation.
90 | *
91 | * Example:
92 | * ```
93 | *
94 | * $query = $datastore->AggregationQuery();
95 | * $query->kind('Companies');
96 | * $query->filter('companyName', '=', 'Google');
97 | * $query->addAggregation(Aggregation::count()->alias('total'));
98 | * echo json_encode($query->queryObject());
99 | * ```
100 | *
101 | * @param Aggregation $aggregation The Aggregation to be included.
102 | * @return AggregationQuery
103 | */
104 | public function addAggregation($aggregation)
105 | {
106 | $this->aggregates[] = $aggregation->getProps();
107 | return $this;
108 | }
109 |
110 | /**
111 | * Set the Query Projection.
112 | *
113 | * Accepts an array of properties. If set, only these properties will be
114 | * returned.
115 | *
116 | * Example:
117 | * ```
118 | * $query = $datastore->query();
119 | * $query->kind('Companies');
120 | * $query->filter('companyName', '=', 'Google');
121 | *
122 | * $pipeline = $datastore->AggregationQuery()
123 | * ->over($query)
124 | * ->addAggregation(Aggregation::count()->alias('total'));
125 | * ```
126 | *
127 | * @param QueryInterface $query The query whose properties to include.
128 | * @return AggregationQuery
129 | */
130 | public function over($query)
131 | {
132 | $this->query = $query;
133 | return $this;
134 | }
135 |
136 | /**
137 | * Format the query for use in the API.
138 | *
139 | * @return array
140 | * @throws UnexpectedValueException If the query is not supported.
141 | */
142 | public function queryObject()
143 | {
144 | if ($this->query instanceof Query) {
145 | return [
146 | 'aggregationQuery' => [
147 | 'nestedQuery' => $this->query->queryObject(),
148 | 'aggregations' => $this->aggregates,
149 | ]
150 | ];
151 | }
152 | if ($this->query instanceof GqlQuery) {
153 | return [
154 | 'gqlQuery' => $this->query->queryObject(),
155 | ];
156 | }
157 | throw new UnexpectedValueException('unknown query type');
158 | }
159 | }
160 |
--------------------------------------------------------------------------------
/src/Query/AggregationQueryResult.php:
--------------------------------------------------------------------------------
1 | AggregationQuery();
35 | * $query->kind('Companies');
36 | * $query->filter('companyName', '=', 'Google');
37 | * $query->limit(100);
38 | * $query->addAggregation(Aggregation::count()->alias('total_upto_100'));
39 | *
40 | * $res = $datastore->runAggregationQuery($query);
41 | * echo $res->get('total_upto_100');
42 | * ```
43 | *
44 | * @see https://cloud.google.com/datastore/reference/rest/v1/projects/runAggregationQuery#query
45 | * Aggregation Query Object Reference
46 | * @see https://cloud.google.com/datastore/docs/aggregation-queries Aggregation Queries
47 | */
48 | class AggregationQueryResult
49 | {
50 | use TimestampTrait;
51 |
52 | /**
53 | * @var AggregationQuery
54 | */
55 | private $query;
56 |
57 | /**
58 | * @var Timestamp
59 | */
60 | private $readTime;
61 |
62 | /**
63 | * @var array
64 | */
65 | private array $aggregationResults = [];
66 |
67 | /**
68 | * @var string|null
69 | */
70 | private $transaction;
71 |
72 | /**
73 | * @var EntityMapper
74 | */
75 | private $mapper;
76 |
77 | /**
78 | * Create AggregationQueryResult object.
79 | *
80 | * @param array $result Response of
81 | * [RunAggregationQuery](https://cloud.google.com/datastore/docs/reference/data/rest/v1/projects/runAggregationQuery)
82 | * @param EntityMapper $mapper [Optional] Entity mapper to map datastore values
83 | * to their equivalent php values incase of `null`, `NAN`, `INF` and `-INF`
84 | */
85 | public function __construct($result = [], $mapper = null)
86 | {
87 | // When executing an Agggregation query nested with GqlQuery, the server will return
88 | // the parsed query with the first response batch.
89 | if (isset($result['query'])) {
90 | $this->query = new AggregationQuery(
91 | $result['query']['nestedQuery'],
92 | $result['query']['aggregations']
93 | );
94 | }
95 | if (isset($result['transaction'])) {
96 | $this->transaction = $result['transaction'];
97 | }
98 | if (isset($result['batch']['aggregationResults'])) {
99 | $this->aggregationResults = $result['batch']['aggregationResults'];
100 | }
101 | if (isset($result['batch']['readTime'])) {
102 | $this->readTime = $result['batch']['readTime'];
103 | }
104 |
105 | // Though the client always passes an entity mapper object, we need to
106 | // re-instantiate an entity mapper incase a user creates an instance of
107 | // AggregationQueryResult manually without supplying the `$entityMapper`.
108 | // Here, entity mapper is used to parse response +/- 'Infinity' to +/- `INF`,
109 | // 'NaN' to `NAN` and ['nullValue' => 0] to ['nullValue' => null]. Therefore the
110 | // usage is independent of `$projectId` or other arguments.
111 | $this->mapper = $mapper ?? new EntityMapper('', true, false);
112 | }
113 |
114 | /**
115 | * Get the Query Aggregation value.
116 | *
117 | * Example:
118 | * ```
119 | * $query = $datastore->AggregationQuery();
120 | * $query->kind('Companies');
121 | * $query->filter('companyName', '=', 'Google');
122 | * $query->addAggregation(Aggregation::count()->alias('total'));
123 | * $res = $client->runAggregationQuery($query);
124 | * echo $res->get('total');
125 | * ```
126 | *
127 | * @param string $alias The aggregation alias.
128 | * @return mixed
129 | * @throws InvalidArgumentException If provided alias does not exist in result.
130 | */
131 | public function get($alias)
132 | {
133 | if (!isset($this->aggregationResults[0]['aggregateProperties'][$alias])) {
134 | throw new InvalidArgumentException('alias does not exist');
135 | }
136 | $result = $this->aggregationResults[0]['aggregateProperties'][$alias];
137 | if (is_array($result)) {
138 | $key = array_key_first($result);
139 | return $this->mapper->convertValue($key, $result[$key]);
140 | }
141 | return $result;
142 | }
143 |
144 | /**
145 | * Gets the value of query for example in case of a GqlQuery.
146 | *
147 | * @return AggregationQuery
148 | */
149 | public function getQuery()
150 | {
151 | return $this->query;
152 | }
153 |
154 | /**
155 | * Gets the transaction id when Aggregation is associated with a Transaction.
156 | *
157 | * @return string|null
158 | */
159 | public function getTransaction()
160 | {
161 | return $this->transaction;
162 | }
163 |
164 | /**
165 | * Gets the timsstamp when Aggregation was executed.
166 | *
167 | * @return Timestamp
168 | */
169 | public function getReadTime()
170 | {
171 | return $this->readTime;
172 | }
173 | }
174 |
--------------------------------------------------------------------------------
/src/Query/Filter.php:
--------------------------------------------------------------------------------
1 | query();
31 | * $query->kind('Companies');
32 | * $query->filter($filter);
33 | * $results = $datastore->runQuery($query);
34 | * $finalResult = [];
35 | * foreach ($results as $result) {
36 | * $finalResult[] = $result['companyName'];
37 | * }
38 | * ```
39 | *
40 | * Composite filters can be created by using other composite/property
41 | * filters.
42 | * ```
43 | * // Or filter
44 | * $filterType = 'or';
45 | * $filterOr = Filter::or([$filter, ...$filters]);
46 | * $query = $datastore->query();
47 | * $query->kind('Companies');
48 | * $query->filter($filter);
49 | * $results = $datastore->runQuery($query);
50 | * $finalResult = [];
51 | * foreach ($results as $result) {
52 | * $finalResult[] = $result['companyName'];
53 | * }
54 | * ```
55 | *
56 | * Similaryly, `AND` filter can be created using `Filter::and` method.
57 | */
58 | class Filter
59 | {
60 | /**
61 | * Creates a property filter in array format.
62 | *
63 | * @param string $property Property name
64 | * @param string $operator Operator, one of ('=', '<', '<=', '>', '>=',
65 | * '!=', 'IN', 'NOT IN')
66 | * @param mixed $value Value for operation on property
67 | * @return array Returns array representation of a property filter.
68 | */
69 | public static function where($property, $operator, $value)
70 | {
71 | return self::propertyFilter($property, $operator, $value);
72 | }
73 |
74 | /**
75 | * Creates an AND composite filter in array format.
76 | *
77 | * @param array $filters An array of filters(array representations) to AND
78 | * upon.
79 | * @return array Returns array representation of AND composite filter.
80 | */
81 | public static function and(array $filters)
82 | {
83 | return self::compositeFilter('AND', $filters);
84 | }
85 |
86 | /**
87 | * Creates a OR composite filter in array format.
88 | *
89 | * @param array $filters An array of filters(array representations) to OR
90 | * upon.
91 | * @return array Returns array representation of OR composite filter.
92 | */
93 | public static function or(array $filters)
94 | {
95 | return self::compositeFilter('OR', $filters);
96 | }
97 |
98 | private static function propertyFilter($property, $operator, $value)
99 | {
100 | $filter = [
101 | 'propertyFilter' => [
102 | 'property' => $property,
103 | 'value' => $value,
104 | 'op' => $operator
105 | ]
106 | ];
107 | return $filter;
108 | }
109 |
110 | /**
111 | * @param string $type Type of Composite Filter, i.e. `AND` / `OR`.
112 | * There values are checked in `Query::filter()` method.
113 | * @param array $filters Filter array to operator on.
114 | */
115 | private static function compositeFilter($type, $filters)
116 | {
117 | $filter = [
118 | 'compositeFilter' => [
119 | 'op' => $type,
120 | 'filters' => $filters
121 | ]
122 | ];
123 | return $filter;
124 | }
125 | }
126 |
--------------------------------------------------------------------------------
/src/Query/QueryInterface.php:
--------------------------------------------------------------------------------
1 | readOnlyTransaction();
41 | * ```
42 | *
43 | * ```
44 | * // Read-Only Transactions should be rolled back when they are no longer needed.
45 | * $key = $datastore->key('Users', 'Bob');
46 | * $userData = $transaction->lookup($key);
47 | *
48 | * $transaction->rollback();
49 | * ```
50 | *
51 | * @see https://cloud.google.com/datastore/docs/concepts/transactions Transactions
52 | */
53 | class ReadOnlyTransaction
54 | {
55 | use TransactionTrait;
56 | }
57 |
--------------------------------------------------------------------------------
/src/V1/AggregationQuery.php:
--------------------------------------------------------------------------------
1 | google.datastore.v1.AggregationQuery
16 | */
17 | class AggregationQuery extends \Google\Protobuf\Internal\Message
18 | {
19 | /**
20 | * Optional. Series of aggregations to apply over the results of the
21 | * `nested_query`.
22 | * Requires:
23 | * * A minimum of one and maximum of five aggregations per query.
24 | *
25 | * Generated from protobuf field repeated .google.datastore.v1.AggregationQuery.Aggregation aggregations = 3 [(.google.api.field_behavior) = OPTIONAL];
26 | */
27 | private $aggregations;
28 | protected $query_type;
29 |
30 | /**
31 | * Constructor.
32 | *
33 | * @param array $data {
34 | * Optional. Data for populating the Message object.
35 | *
36 | * @type \Google\Cloud\Datastore\V1\Query $nested_query
37 | * Nested query for aggregation
38 | * @type array<\Google\Cloud\Datastore\V1\AggregationQuery\Aggregation>|\Google\Protobuf\Internal\RepeatedField $aggregations
39 | * Optional. Series of aggregations to apply over the results of the
40 | * `nested_query`.
41 | * Requires:
42 | * * A minimum of one and maximum of five aggregations per query.
43 | * }
44 | */
45 | public function __construct($data = NULL) {
46 | \GPBMetadata\Google\Datastore\V1\Query::initOnce();
47 | parent::__construct($data);
48 | }
49 |
50 | /**
51 | * Nested query for aggregation
52 | *
53 | * Generated from protobuf field .google.datastore.v1.Query nested_query = 1;
54 | * @return \Google\Cloud\Datastore\V1\Query|null
55 | */
56 | public function getNestedQuery()
57 | {
58 | return $this->readOneof(1);
59 | }
60 |
61 | public function hasNestedQuery()
62 | {
63 | return $this->hasOneof(1);
64 | }
65 |
66 | /**
67 | * Nested query for aggregation
68 | *
69 | * Generated from protobuf field .google.datastore.v1.Query nested_query = 1;
70 | * @param \Google\Cloud\Datastore\V1\Query $var
71 | * @return $this
72 | */
73 | public function setNestedQuery($var)
74 | {
75 | GPBUtil::checkMessage($var, \Google\Cloud\Datastore\V1\Query::class);
76 | $this->writeOneof(1, $var);
77 |
78 | return $this;
79 | }
80 |
81 | /**
82 | * Optional. Series of aggregations to apply over the results of the
83 | * `nested_query`.
84 | * Requires:
85 | * * A minimum of one and maximum of five aggregations per query.
86 | *
87 | * Generated from protobuf field repeated .google.datastore.v1.AggregationQuery.Aggregation aggregations = 3 [(.google.api.field_behavior) = OPTIONAL];
88 | * @return \Google\Protobuf\Internal\RepeatedField
89 | */
90 | public function getAggregations()
91 | {
92 | return $this->aggregations;
93 | }
94 |
95 | /**
96 | * Optional. Series of aggregations to apply over the results of the
97 | * `nested_query`.
98 | * Requires:
99 | * * A minimum of one and maximum of five aggregations per query.
100 | *
101 | * Generated from protobuf field repeated .google.datastore.v1.AggregationQuery.Aggregation aggregations = 3 [(.google.api.field_behavior) = OPTIONAL];
102 | * @param array<\Google\Cloud\Datastore\V1\AggregationQuery\Aggregation>|\Google\Protobuf\Internal\RepeatedField $var
103 | * @return $this
104 | */
105 | public function setAggregations($var)
106 | {
107 | $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Datastore\V1\AggregationQuery\Aggregation::class);
108 | $this->aggregations = $arr;
109 |
110 | return $this;
111 | }
112 |
113 | /**
114 | * @return string
115 | */
116 | public function getQueryType()
117 | {
118 | return $this->whichOneof("query_type");
119 | }
120 |
121 | }
122 |
123 |
--------------------------------------------------------------------------------
/src/V1/AggregationQuery/Aggregation/Avg.php:
--------------------------------------------------------------------------------
1 | google.datastore.v1.AggregationQuery.Aggregation.Avg
21 | */
22 | class Avg extends \Google\Protobuf\Internal\Message
23 | {
24 | /**
25 | * The property to aggregate on.
26 | *
27 | * Generated from protobuf field .google.datastore.v1.PropertyReference property = 1;
28 | */
29 | private $property = null;
30 |
31 | /**
32 | * Constructor.
33 | *
34 | * @param array $data {
35 | * Optional. Data for populating the Message object.
36 | *
37 | * @type \Google\Cloud\Datastore\V1\PropertyReference $property
38 | * The property to aggregate on.
39 | * }
40 | */
41 | public function __construct($data = NULL) {
42 | \GPBMetadata\Google\Datastore\V1\Query::initOnce();
43 | parent::__construct($data);
44 | }
45 |
46 | /**
47 | * The property to aggregate on.
48 | *
49 | * Generated from protobuf field .google.datastore.v1.PropertyReference property = 1;
50 | * @return \Google\Cloud\Datastore\V1\PropertyReference|null
51 | */
52 | public function getProperty()
53 | {
54 | return $this->property;
55 | }
56 |
57 | public function hasProperty()
58 | {
59 | return isset($this->property);
60 | }
61 |
62 | public function clearProperty()
63 | {
64 | unset($this->property);
65 | }
66 |
67 | /**
68 | * The property to aggregate on.
69 | *
70 | * Generated from protobuf field .google.datastore.v1.PropertyReference property = 1;
71 | * @param \Google\Cloud\Datastore\V1\PropertyReference $var
72 | * @return $this
73 | */
74 | public function setProperty($var)
75 | {
76 | GPBUtil::checkMessage($var, \Google\Cloud\Datastore\V1\PropertyReference::class);
77 | $this->property = $var;
78 |
79 | return $this;
80 | }
81 |
82 | }
83 |
84 | // Adding a class alias for backwards compatibility with the previous class name.
85 | class_alias(Avg::class, \Google\Cloud\Datastore\V1\AggregationQuery_Aggregation_Avg::class);
86 |
87 |
--------------------------------------------------------------------------------
/src/V1/AggregationQuery/Aggregation/Sum.php:
--------------------------------------------------------------------------------
1 | google.datastore.v1.AggregationQuery.Aggregation.Sum
30 | */
31 | class Sum extends \Google\Protobuf\Internal\Message
32 | {
33 | /**
34 | * The property to aggregate on.
35 | *
36 | * Generated from protobuf field .google.datastore.v1.PropertyReference property = 1;
37 | */
38 | private $property = null;
39 |
40 | /**
41 | * Constructor.
42 | *
43 | * @param array $data {
44 | * Optional. Data for populating the Message object.
45 | *
46 | * @type \Google\Cloud\Datastore\V1\PropertyReference $property
47 | * The property to aggregate on.
48 | * }
49 | */
50 | public function __construct($data = NULL) {
51 | \GPBMetadata\Google\Datastore\V1\Query::initOnce();
52 | parent::__construct($data);
53 | }
54 |
55 | /**
56 | * The property to aggregate on.
57 | *
58 | * Generated from protobuf field .google.datastore.v1.PropertyReference property = 1;
59 | * @return \Google\Cloud\Datastore\V1\PropertyReference|null
60 | */
61 | public function getProperty()
62 | {
63 | return $this->property;
64 | }
65 |
66 | public function hasProperty()
67 | {
68 | return isset($this->property);
69 | }
70 |
71 | public function clearProperty()
72 | {
73 | unset($this->property);
74 | }
75 |
76 | /**
77 | * The property to aggregate on.
78 | *
79 | * Generated from protobuf field .google.datastore.v1.PropertyReference property = 1;
80 | * @param \Google\Cloud\Datastore\V1\PropertyReference $var
81 | * @return $this
82 | */
83 | public function setProperty($var)
84 | {
85 | GPBUtil::checkMessage($var, \Google\Cloud\Datastore\V1\PropertyReference::class);
86 | $this->property = $var;
87 |
88 | return $this;
89 | }
90 |
91 | }
92 |
93 | // Adding a class alias for backwards compatibility with the previous class name.
94 | class_alias(Sum::class, \Google\Cloud\Datastore\V1\AggregationQuery_Aggregation_Sum::class);
95 |
96 |
--------------------------------------------------------------------------------
/src/V1/AggregationQuery_Aggregation.php:
--------------------------------------------------------------------------------
1 | google.datastore.v1.AggregationResult
18 | */
19 | class AggregationResult extends \Google\Protobuf\Internal\Message
20 | {
21 | /**
22 | * The result of the aggregation functions, ex: `COUNT(*) AS total_entities`.
23 | * The key is the
24 | * [alias][google.datastore.v1.AggregationQuery.Aggregation.alias] assigned to
25 | * the aggregation function on input and the size of this map equals the
26 | * number of aggregation functions in the query.
27 | *
28 | * Generated from protobuf field map aggregate_properties = 2;
29 | */
30 | private $aggregate_properties;
31 |
32 | /**
33 | * Constructor.
34 | *
35 | * @param array $data {
36 | * Optional. Data for populating the Message object.
37 | *
38 | * @type array|\Google\Protobuf\Internal\MapField $aggregate_properties
39 | * The result of the aggregation functions, ex: `COUNT(*) AS total_entities`.
40 | * The key is the
41 | * [alias][google.datastore.v1.AggregationQuery.Aggregation.alias] assigned to
42 | * the aggregation function on input and the size of this map equals the
43 | * number of aggregation functions in the query.
44 | * }
45 | */
46 | public function __construct($data = NULL) {
47 | \GPBMetadata\Google\Datastore\V1\AggregationResult::initOnce();
48 | parent::__construct($data);
49 | }
50 |
51 | /**
52 | * The result of the aggregation functions, ex: `COUNT(*) AS total_entities`.
53 | * The key is the
54 | * [alias][google.datastore.v1.AggregationQuery.Aggregation.alias] assigned to
55 | * the aggregation function on input and the size of this map equals the
56 | * number of aggregation functions in the query.
57 | *
58 | * Generated from protobuf field map aggregate_properties = 2;
59 | * @return \Google\Protobuf\Internal\MapField
60 | */
61 | public function getAggregateProperties()
62 | {
63 | return $this->aggregate_properties;
64 | }
65 |
66 | /**
67 | * The result of the aggregation functions, ex: `COUNT(*) AS total_entities`.
68 | * The key is the
69 | * [alias][google.datastore.v1.AggregationQuery.Aggregation.alias] assigned to
70 | * the aggregation function on input and the size of this map equals the
71 | * number of aggregation functions in the query.
72 | *
73 | * Generated from protobuf field map aggregate_properties = 2;
74 | * @param array|\Google\Protobuf\Internal\MapField $var
75 | * @return $this
76 | */
77 | public function setAggregateProperties($var)
78 | {
79 | $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Datastore\V1\Value::class);
80 | $this->aggregate_properties = $arr;
81 |
82 | return $this;
83 | }
84 |
85 | }
86 |
87 |
--------------------------------------------------------------------------------
/src/V1/AllocateIdsResponse.php:
--------------------------------------------------------------------------------
1 | google.datastore.v1.AllocateIdsResponse
16 | */
17 | class AllocateIdsResponse extends \Google\Protobuf\Internal\Message
18 | {
19 | /**
20 | * The keys specified in the request (in the same order), each with
21 | * its key path completed with a newly allocated ID.
22 | *
23 | * Generated from protobuf field repeated .google.datastore.v1.Key keys = 1;
24 | */
25 | private $keys;
26 |
27 | /**
28 | * Constructor.
29 | *
30 | * @param array $data {
31 | * Optional. Data for populating the Message object.
32 | *
33 | * @type array<\Google\Cloud\Datastore\V1\Key>|\Google\Protobuf\Internal\RepeatedField $keys
34 | * The keys specified in the request (in the same order), each with
35 | * its key path completed with a newly allocated ID.
36 | * }
37 | */
38 | public function __construct($data = NULL) {
39 | \GPBMetadata\Google\Datastore\V1\Datastore::initOnce();
40 | parent::__construct($data);
41 | }
42 |
43 | /**
44 | * The keys specified in the request (in the same order), each with
45 | * its key path completed with a newly allocated ID.
46 | *
47 | * Generated from protobuf field repeated .google.datastore.v1.Key keys = 1;
48 | * @return \Google\Protobuf\Internal\RepeatedField
49 | */
50 | public function getKeys()
51 | {
52 | return $this->keys;
53 | }
54 |
55 | /**
56 | * The keys specified in the request (in the same order), each with
57 | * its key path completed with a newly allocated ID.
58 | *
59 | * Generated from protobuf field repeated .google.datastore.v1.Key keys = 1;
60 | * @param array<\Google\Cloud\Datastore\V1\Key>|\Google\Protobuf\Internal\RepeatedField $var
61 | * @return $this
62 | */
63 | public function setKeys($var)
64 | {
65 | $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Datastore\V1\Key::class);
66 | $this->keys = $arr;
67 |
68 | return $this;
69 | }
70 |
71 | }
72 |
73 |
--------------------------------------------------------------------------------
/src/V1/ArrayValue.php:
--------------------------------------------------------------------------------
1 | google.datastore.v1.ArrayValue
15 | */
16 | class ArrayValue extends \Google\Protobuf\Internal\Message
17 | {
18 | /**
19 | * Values in the array.
20 | * The order of values in an array is preserved as long as all values have
21 | * identical settings for 'exclude_from_indexes'.
22 | *
23 | * Generated from protobuf field repeated .google.datastore.v1.Value values = 1;
24 | */
25 | private $values;
26 |
27 | /**
28 | * Constructor.
29 | *
30 | * @param array $data {
31 | * Optional. Data for populating the Message object.
32 | *
33 | * @type array<\Google\Cloud\Datastore\V1\Value>|\Google\Protobuf\Internal\RepeatedField $values
34 | * Values in the array.
35 | * The order of values in an array is preserved as long as all values have
36 | * identical settings for 'exclude_from_indexes'.
37 | * }
38 | */
39 | public function __construct($data = NULL) {
40 | \GPBMetadata\Google\Datastore\V1\Entity::initOnce();
41 | parent::__construct($data);
42 | }
43 |
44 | /**
45 | * Values in the array.
46 | * The order of values in an array is preserved as long as all values have
47 | * identical settings for 'exclude_from_indexes'.
48 | *
49 | * Generated from protobuf field repeated .google.datastore.v1.Value values = 1;
50 | * @return \Google\Protobuf\Internal\RepeatedField
51 | */
52 | public function getValues()
53 | {
54 | return $this->values;
55 | }
56 |
57 | /**
58 | * Values in the array.
59 | * The order of values in an array is preserved as long as all values have
60 | * identical settings for 'exclude_from_indexes'.
61 | *
62 | * Generated from protobuf field repeated .google.datastore.v1.Value values = 1;
63 | * @param array<\Google\Cloud\Datastore\V1\Value>|\Google\Protobuf\Internal\RepeatedField $var
64 | * @return $this
65 | */
66 | public function setValues($var)
67 | {
68 | $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Datastore\V1\Value::class);
69 | $this->values = $arr;
70 |
71 | return $this;
72 | }
73 |
74 | }
75 |
76 |
--------------------------------------------------------------------------------
/src/V1/BeginTransactionRequest.php:
--------------------------------------------------------------------------------
1 | google.datastore.v1.BeginTransactionRequest
16 | */
17 | class BeginTransactionRequest extends \Google\Protobuf\Internal\Message
18 | {
19 | /**
20 | * Required. The ID of the project against which to make the request.
21 | *
22 | * Generated from protobuf field string project_id = 8 [(.google.api.field_behavior) = REQUIRED];
23 | */
24 | private $project_id = '';
25 | /**
26 | * The ID of the database against which to make the request.
27 | * '(default)' is not allowed; please use empty string '' to refer the default
28 | * database.
29 | *
30 | * Generated from protobuf field string database_id = 9;
31 | */
32 | private $database_id = '';
33 | /**
34 | * Options for a new transaction.
35 | *
36 | * Generated from protobuf field .google.datastore.v1.TransactionOptions transaction_options = 10;
37 | */
38 | private $transaction_options = null;
39 |
40 | /**
41 | * @param string $projectId Required. The ID of the project against which to make the request.
42 | *
43 | * @return \Google\Cloud\Datastore\V1\BeginTransactionRequest
44 | *
45 | * @experimental
46 | */
47 | public static function build(string $projectId): self
48 | {
49 | return (new self())
50 | ->setProjectId($projectId);
51 | }
52 |
53 | /**
54 | * Constructor.
55 | *
56 | * @param array $data {
57 | * Optional. Data for populating the Message object.
58 | *
59 | * @type string $project_id
60 | * Required. The ID of the project against which to make the request.
61 | * @type string $database_id
62 | * The ID of the database against which to make the request.
63 | * '(default)' is not allowed; please use empty string '' to refer the default
64 | * database.
65 | * @type \Google\Cloud\Datastore\V1\TransactionOptions $transaction_options
66 | * Options for a new transaction.
67 | * }
68 | */
69 | public function __construct($data = NULL) {
70 | \GPBMetadata\Google\Datastore\V1\Datastore::initOnce();
71 | parent::__construct($data);
72 | }
73 |
74 | /**
75 | * Required. The ID of the project against which to make the request.
76 | *
77 | * Generated from protobuf field string project_id = 8 [(.google.api.field_behavior) = REQUIRED];
78 | * @return string
79 | */
80 | public function getProjectId()
81 | {
82 | return $this->project_id;
83 | }
84 |
85 | /**
86 | * Required. The ID of the project against which to make the request.
87 | *
88 | * Generated from protobuf field string project_id = 8 [(.google.api.field_behavior) = REQUIRED];
89 | * @param string $var
90 | * @return $this
91 | */
92 | public function setProjectId($var)
93 | {
94 | GPBUtil::checkString($var, True);
95 | $this->project_id = $var;
96 |
97 | return $this;
98 | }
99 |
100 | /**
101 | * The ID of the database against which to make the request.
102 | * '(default)' is not allowed; please use empty string '' to refer the default
103 | * database.
104 | *
105 | * Generated from protobuf field string database_id = 9;
106 | * @return string
107 | */
108 | public function getDatabaseId()
109 | {
110 | return $this->database_id;
111 | }
112 |
113 | /**
114 | * The ID of the database against which to make the request.
115 | * '(default)' is not allowed; please use empty string '' to refer the default
116 | * database.
117 | *
118 | * Generated from protobuf field string database_id = 9;
119 | * @param string $var
120 | * @return $this
121 | */
122 | public function setDatabaseId($var)
123 | {
124 | GPBUtil::checkString($var, True);
125 | $this->database_id = $var;
126 |
127 | return $this;
128 | }
129 |
130 | /**
131 | * Options for a new transaction.
132 | *
133 | * Generated from protobuf field .google.datastore.v1.TransactionOptions transaction_options = 10;
134 | * @return \Google\Cloud\Datastore\V1\TransactionOptions|null
135 | */
136 | public function getTransactionOptions()
137 | {
138 | return $this->transaction_options;
139 | }
140 |
141 | public function hasTransactionOptions()
142 | {
143 | return isset($this->transaction_options);
144 | }
145 |
146 | public function clearTransactionOptions()
147 | {
148 | unset($this->transaction_options);
149 | }
150 |
151 | /**
152 | * Options for a new transaction.
153 | *
154 | * Generated from protobuf field .google.datastore.v1.TransactionOptions transaction_options = 10;
155 | * @param \Google\Cloud\Datastore\V1\TransactionOptions $var
156 | * @return $this
157 | */
158 | public function setTransactionOptions($var)
159 | {
160 | GPBUtil::checkMessage($var, \Google\Cloud\Datastore\V1\TransactionOptions::class);
161 | $this->transaction_options = $var;
162 |
163 | return $this;
164 | }
165 |
166 | }
167 |
168 |
--------------------------------------------------------------------------------
/src/V1/BeginTransactionResponse.php:
--------------------------------------------------------------------------------
1 | google.datastore.v1.BeginTransactionResponse
16 | */
17 | class BeginTransactionResponse extends \Google\Protobuf\Internal\Message
18 | {
19 | /**
20 | * The transaction identifier (always present).
21 | *
22 | * Generated from protobuf field bytes transaction = 1;
23 | */
24 | private $transaction = '';
25 |
26 | /**
27 | * Constructor.
28 | *
29 | * @param array $data {
30 | * Optional. Data for populating the Message object.
31 | *
32 | * @type string $transaction
33 | * The transaction identifier (always present).
34 | * }
35 | */
36 | public function __construct($data = NULL) {
37 | \GPBMetadata\Google\Datastore\V1\Datastore::initOnce();
38 | parent::__construct($data);
39 | }
40 |
41 | /**
42 | * The transaction identifier (always present).
43 | *
44 | * Generated from protobuf field bytes transaction = 1;
45 | * @return string
46 | */
47 | public function getTransaction()
48 | {
49 | return $this->transaction;
50 | }
51 |
52 | /**
53 | * The transaction identifier (always present).
54 | *
55 | * Generated from protobuf field bytes transaction = 1;
56 | * @param string $var
57 | * @return $this
58 | */
59 | public function setTransaction($var)
60 | {
61 | GPBUtil::checkString($var, False);
62 | $this->transaction = $var;
63 |
64 | return $this;
65 | }
66 |
67 | }
68 |
69 |
--------------------------------------------------------------------------------
/src/V1/CommitRequest/Mode.php:
--------------------------------------------------------------------------------
1 | google.datastore.v1.CommitRequest.Mode
13 | */
14 | class Mode
15 | {
16 | /**
17 | * Unspecified. This value must not be used.
18 | *
19 | * Generated from protobuf enum MODE_UNSPECIFIED = 0;
20 | */
21 | const MODE_UNSPECIFIED = 0;
22 | /**
23 | * Transactional: The mutations are either all applied, or none are applied.
24 | * Learn about transactions
25 | * [here](https://cloud.google.com/datastore/docs/concepts/transactions).
26 | *
27 | * Generated from protobuf enum TRANSACTIONAL = 1;
28 | */
29 | const TRANSACTIONAL = 1;
30 | /**
31 | * Non-transactional: The mutations may not apply as all or none.
32 | *
33 | * Generated from protobuf enum NON_TRANSACTIONAL = 2;
34 | */
35 | const NON_TRANSACTIONAL = 2;
36 |
37 | private static $valueToName = [
38 | self::MODE_UNSPECIFIED => 'MODE_UNSPECIFIED',
39 | self::TRANSACTIONAL => 'TRANSACTIONAL',
40 | self::NON_TRANSACTIONAL => 'NON_TRANSACTIONAL',
41 | ];
42 |
43 | public static function name($value)
44 | {
45 | if (!isset(self::$valueToName[$value])) {
46 | throw new UnexpectedValueException(sprintf(
47 | 'Enum %s has no name defined for value %s', __CLASS__, $value));
48 | }
49 | return self::$valueToName[$value];
50 | }
51 |
52 |
53 | public static function value($name)
54 | {
55 | $const = __CLASS__ . '::' . strtoupper($name);
56 | if (!defined($const)) {
57 | throw new UnexpectedValueException(sprintf(
58 | 'Enum %s has no value defined for name %s', __CLASS__, $name));
59 | }
60 | return constant($const);
61 | }
62 | }
63 |
64 | // Adding a class alias for backwards compatibility with the previous class name.
65 | class_alias(Mode::class, \Google\Cloud\Datastore\V1\CommitRequest_Mode::class);
66 |
67 |
--------------------------------------------------------------------------------
/src/V1/CommitRequest_Mode.php:
--------------------------------------------------------------------------------
1 | google.datastore.v1.CommitResponse
15 | */
16 | class CommitResponse extends \Google\Protobuf\Internal\Message
17 | {
18 | /**
19 | * The result of performing the mutations.
20 | * The i-th mutation result corresponds to the i-th mutation in the request.
21 | *
22 | * Generated from protobuf field repeated .google.datastore.v1.MutationResult mutation_results = 3;
23 | */
24 | private $mutation_results;
25 | /**
26 | * The number of index entries updated during the commit, or zero if none were
27 | * updated.
28 | *
29 | * Generated from protobuf field int32 index_updates = 4;
30 | */
31 | private $index_updates = 0;
32 | /**
33 | * The transaction commit timestamp. Not set for non-transactional commits.
34 | *
35 | * Generated from protobuf field .google.protobuf.Timestamp commit_time = 8;
36 | */
37 | private $commit_time = null;
38 |
39 | /**
40 | * Constructor.
41 | *
42 | * @param array $data {
43 | * Optional. Data for populating the Message object.
44 | *
45 | * @type array<\Google\Cloud\Datastore\V1\MutationResult>|\Google\Protobuf\Internal\RepeatedField $mutation_results
46 | * The result of performing the mutations.
47 | * The i-th mutation result corresponds to the i-th mutation in the request.
48 | * @type int $index_updates
49 | * The number of index entries updated during the commit, or zero if none were
50 | * updated.
51 | * @type \Google\Protobuf\Timestamp $commit_time
52 | * The transaction commit timestamp. Not set for non-transactional commits.
53 | * }
54 | */
55 | public function __construct($data = NULL) {
56 | \GPBMetadata\Google\Datastore\V1\Datastore::initOnce();
57 | parent::__construct($data);
58 | }
59 |
60 | /**
61 | * The result of performing the mutations.
62 | * The i-th mutation result corresponds to the i-th mutation in the request.
63 | *
64 | * Generated from protobuf field repeated .google.datastore.v1.MutationResult mutation_results = 3;
65 | * @return \Google\Protobuf\Internal\RepeatedField
66 | */
67 | public function getMutationResults()
68 | {
69 | return $this->mutation_results;
70 | }
71 |
72 | /**
73 | * The result of performing the mutations.
74 | * The i-th mutation result corresponds to the i-th mutation in the request.
75 | *
76 | * Generated from protobuf field repeated .google.datastore.v1.MutationResult mutation_results = 3;
77 | * @param array<\Google\Cloud\Datastore\V1\MutationResult>|\Google\Protobuf\Internal\RepeatedField $var
78 | * @return $this
79 | */
80 | public function setMutationResults($var)
81 | {
82 | $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Datastore\V1\MutationResult::class);
83 | $this->mutation_results = $arr;
84 |
85 | return $this;
86 | }
87 |
88 | /**
89 | * The number of index entries updated during the commit, or zero if none were
90 | * updated.
91 | *
92 | * Generated from protobuf field int32 index_updates = 4;
93 | * @return int
94 | */
95 | public function getIndexUpdates()
96 | {
97 | return $this->index_updates;
98 | }
99 |
100 | /**
101 | * The number of index entries updated during the commit, or zero if none were
102 | * updated.
103 | *
104 | * Generated from protobuf field int32 index_updates = 4;
105 | * @param int $var
106 | * @return $this
107 | */
108 | public function setIndexUpdates($var)
109 | {
110 | GPBUtil::checkInt32($var);
111 | $this->index_updates = $var;
112 |
113 | return $this;
114 | }
115 |
116 | /**
117 | * The transaction commit timestamp. Not set for non-transactional commits.
118 | *
119 | * Generated from protobuf field .google.protobuf.Timestamp commit_time = 8;
120 | * @return \Google\Protobuf\Timestamp|null
121 | */
122 | public function getCommitTime()
123 | {
124 | return $this->commit_time;
125 | }
126 |
127 | public function hasCommitTime()
128 | {
129 | return isset($this->commit_time);
130 | }
131 |
132 | public function clearCommitTime()
133 | {
134 | unset($this->commit_time);
135 | }
136 |
137 | /**
138 | * The transaction commit timestamp. Not set for non-transactional commits.
139 | *
140 | * Generated from protobuf field .google.protobuf.Timestamp commit_time = 8;
141 | * @param \Google\Protobuf\Timestamp $var
142 | * @return $this
143 | */
144 | public function setCommitTime($var)
145 | {
146 | GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class);
147 | $this->commit_time = $var;
148 |
149 | return $this;
150 | }
151 |
152 | }
153 |
154 |
--------------------------------------------------------------------------------
/src/V1/CompositeFilter.php:
--------------------------------------------------------------------------------
1 | google.datastore.v1.CompositeFilter
15 | */
16 | class CompositeFilter extends \Google\Protobuf\Internal\Message
17 | {
18 | /**
19 | * The operator for combining multiple filters.
20 | *
21 | * Generated from protobuf field .google.datastore.v1.CompositeFilter.Operator op = 1;
22 | */
23 | private $op = 0;
24 | /**
25 | * The list of filters to combine.
26 | * Requires:
27 | * * At least one filter is present.
28 | *
29 | * Generated from protobuf field repeated .google.datastore.v1.Filter filters = 2;
30 | */
31 | private $filters;
32 |
33 | /**
34 | * Constructor.
35 | *
36 | * @param array $data {
37 | * Optional. Data for populating the Message object.
38 | *
39 | * @type int $op
40 | * The operator for combining multiple filters.
41 | * @type array<\Google\Cloud\Datastore\V1\Filter>|\Google\Protobuf\Internal\RepeatedField $filters
42 | * The list of filters to combine.
43 | * Requires:
44 | * * At least one filter is present.
45 | * }
46 | */
47 | public function __construct($data = NULL) {
48 | \GPBMetadata\Google\Datastore\V1\Query::initOnce();
49 | parent::__construct($data);
50 | }
51 |
52 | /**
53 | * The operator for combining multiple filters.
54 | *
55 | * Generated from protobuf field .google.datastore.v1.CompositeFilter.Operator op = 1;
56 | * @return int
57 | */
58 | public function getOp()
59 | {
60 | return $this->op;
61 | }
62 |
63 | /**
64 | * The operator for combining multiple filters.
65 | *
66 | * Generated from protobuf field .google.datastore.v1.CompositeFilter.Operator op = 1;
67 | * @param int $var
68 | * @return $this
69 | */
70 | public function setOp($var)
71 | {
72 | GPBUtil::checkEnum($var, \Google\Cloud\Datastore\V1\CompositeFilter\Operator::class);
73 | $this->op = $var;
74 |
75 | return $this;
76 | }
77 |
78 | /**
79 | * The list of filters to combine.
80 | * Requires:
81 | * * At least one filter is present.
82 | *
83 | * Generated from protobuf field repeated .google.datastore.v1.Filter filters = 2;
84 | * @return \Google\Protobuf\Internal\RepeatedField
85 | */
86 | public function getFilters()
87 | {
88 | return $this->filters;
89 | }
90 |
91 | /**
92 | * The list of filters to combine.
93 | * Requires:
94 | * * At least one filter is present.
95 | *
96 | * Generated from protobuf field repeated .google.datastore.v1.Filter filters = 2;
97 | * @param array<\Google\Cloud\Datastore\V1\Filter>|\Google\Protobuf\Internal\RepeatedField $var
98 | * @return $this
99 | */
100 | public function setFilters($var)
101 | {
102 | $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Datastore\V1\Filter::class);
103 | $this->filters = $arr;
104 |
105 | return $this;
106 | }
107 |
108 | }
109 |
110 |
--------------------------------------------------------------------------------
/src/V1/CompositeFilter/Operator.php:
--------------------------------------------------------------------------------
1 | google.datastore.v1.CompositeFilter.Operator
13 | */
14 | class Operator
15 | {
16 | /**
17 | * Unspecified. This value must not be used.
18 | *
19 | * Generated from protobuf enum OPERATOR_UNSPECIFIED = 0;
20 | */
21 | const OPERATOR_UNSPECIFIED = 0;
22 | /**
23 | * The results are required to satisfy each of the combined filters.
24 | *
25 | * Generated from protobuf enum AND = 1;
26 | */
27 | const PBAND = 1;
28 | /**
29 | * Documents are required to satisfy at least one of the combined filters.
30 | *
31 | * Generated from protobuf enum OR = 2;
32 | */
33 | const PBOR = 2;
34 |
35 | private static $valueToName = [
36 | self::OPERATOR_UNSPECIFIED => 'OPERATOR_UNSPECIFIED',
37 | self::PBAND => 'AND',
38 | self::PBOR => 'OR',
39 | ];
40 |
41 | public static function name($value)
42 | {
43 | if (!isset(self::$valueToName[$value])) {
44 | throw new UnexpectedValueException(sprintf(
45 | 'Enum %s has no name defined for value %s', __CLASS__, $value));
46 | }
47 | return self::$valueToName[$value];
48 | }
49 |
50 |
51 | public static function value($name)
52 | {
53 | $const = __CLASS__ . '::' . strtoupper($name);
54 | if (!defined($const)) {
55 | $pbconst = __CLASS__. '::PB' . strtoupper($name);
56 | if (!defined($pbconst)) {
57 | throw new UnexpectedValueException(sprintf(
58 | 'Enum %s has no value defined for name %s', __CLASS__, $name));
59 | }
60 | return constant($pbconst);
61 | }
62 | return constant($const);
63 | }
64 | }
65 |
66 | // Adding a class alias for backwards compatibility with the previous class name.
67 | class_alias(Operator::class, \Google\Cloud\Datastore\V1\CompositeFilter_Operator::class);
68 |
69 |
--------------------------------------------------------------------------------
/src/V1/CompositeFilter_Operator.php:
--------------------------------------------------------------------------------
1 | google.datastore.v1.Entity
16 | */
17 | class Entity extends \Google\Protobuf\Internal\Message
18 | {
19 | /**
20 | * The entity's key.
21 | * An entity must have a key, unless otherwise documented (for example,
22 | * an entity in `Value.entity_value` may have no key).
23 | * An entity's kind is its key path's last element's kind,
24 | * or null if it has no key.
25 | *
26 | * Generated from protobuf field .google.datastore.v1.Key key = 1;
27 | */
28 | private $key = null;
29 | /**
30 | * The entity's properties.
31 | * The map's keys are property names.
32 | * A property name matching regex `__.*__` is reserved.
33 | * A reserved property name is forbidden in certain documented contexts.
34 | * The map keys, represented as UTF-8, must not exceed 1,500 bytes and cannot
35 | * be empty.
36 | *
37 | * Generated from protobuf field map properties = 3;
38 | */
39 | private $properties;
40 |
41 | /**
42 | * Constructor.
43 | *
44 | * @param array $data {
45 | * Optional. Data for populating the Message object.
46 | *
47 | * @type \Google\Cloud\Datastore\V1\Key $key
48 | * The entity's key.
49 | * An entity must have a key, unless otherwise documented (for example,
50 | * an entity in `Value.entity_value` may have no key).
51 | * An entity's kind is its key path's last element's kind,
52 | * or null if it has no key.
53 | * @type array|\Google\Protobuf\Internal\MapField $properties
54 | * The entity's properties.
55 | * The map's keys are property names.
56 | * A property name matching regex `__.*__` is reserved.
57 | * A reserved property name is forbidden in certain documented contexts.
58 | * The map keys, represented as UTF-8, must not exceed 1,500 bytes and cannot
59 | * be empty.
60 | * }
61 | */
62 | public function __construct($data = NULL) {
63 | \GPBMetadata\Google\Datastore\V1\Entity::initOnce();
64 | parent::__construct($data);
65 | }
66 |
67 | /**
68 | * The entity's key.
69 | * An entity must have a key, unless otherwise documented (for example,
70 | * an entity in `Value.entity_value` may have no key).
71 | * An entity's kind is its key path's last element's kind,
72 | * or null if it has no key.
73 | *
74 | * Generated from protobuf field .google.datastore.v1.Key key = 1;
75 | * @return \Google\Cloud\Datastore\V1\Key|null
76 | */
77 | public function getKey()
78 | {
79 | return $this->key;
80 | }
81 |
82 | public function hasKey()
83 | {
84 | return isset($this->key);
85 | }
86 |
87 | public function clearKey()
88 | {
89 | unset($this->key);
90 | }
91 |
92 | /**
93 | * The entity's key.
94 | * An entity must have a key, unless otherwise documented (for example,
95 | * an entity in `Value.entity_value` may have no key).
96 | * An entity's kind is its key path's last element's kind,
97 | * or null if it has no key.
98 | *
99 | * Generated from protobuf field .google.datastore.v1.Key key = 1;
100 | * @param \Google\Cloud\Datastore\V1\Key $var
101 | * @return $this
102 | */
103 | public function setKey($var)
104 | {
105 | GPBUtil::checkMessage($var, \Google\Cloud\Datastore\V1\Key::class);
106 | $this->key = $var;
107 |
108 | return $this;
109 | }
110 |
111 | /**
112 | * The entity's properties.
113 | * The map's keys are property names.
114 | * A property name matching regex `__.*__` is reserved.
115 | * A reserved property name is forbidden in certain documented contexts.
116 | * The map keys, represented as UTF-8, must not exceed 1,500 bytes and cannot
117 | * be empty.
118 | *
119 | * Generated from protobuf field map properties = 3;
120 | * @return \Google\Protobuf\Internal\MapField
121 | */
122 | public function getProperties()
123 | {
124 | return $this->properties;
125 | }
126 |
127 | /**
128 | * The entity's properties.
129 | * The map's keys are property names.
130 | * A property name matching regex `__.*__` is reserved.
131 | * A reserved property name is forbidden in certain documented contexts.
132 | * The map keys, represented as UTF-8, must not exceed 1,500 bytes and cannot
133 | * be empty.
134 | *
135 | * Generated from protobuf field map properties = 3;
136 | * @param array|\Google\Protobuf\Internal\MapField $var
137 | * @return $this
138 | */
139 | public function setProperties($var)
140 | {
141 | $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Datastore\V1\Value::class);
142 | $this->properties = $arr;
143 |
144 | return $this;
145 | }
146 |
147 | }
148 |
149 |
--------------------------------------------------------------------------------
/src/V1/EntityResult/ResultType.php:
--------------------------------------------------------------------------------
1 | google.datastore.v1.EntityResult.ResultType
17 | */
18 | class ResultType
19 | {
20 | /**
21 | * Unspecified. This value is never used.
22 | *
23 | * Generated from protobuf enum RESULT_TYPE_UNSPECIFIED = 0;
24 | */
25 | const RESULT_TYPE_UNSPECIFIED = 0;
26 | /**
27 | * The key and properties.
28 | *
29 | * Generated from protobuf enum FULL = 1;
30 | */
31 | const FULL = 1;
32 | /**
33 | * A projected subset of properties. The entity may have no key.
34 | *
35 | * Generated from protobuf enum PROJECTION = 2;
36 | */
37 | const PROJECTION = 2;
38 | /**
39 | * Only the key.
40 | *
41 | * Generated from protobuf enum KEY_ONLY = 3;
42 | */
43 | const KEY_ONLY = 3;
44 |
45 | private static $valueToName = [
46 | self::RESULT_TYPE_UNSPECIFIED => 'RESULT_TYPE_UNSPECIFIED',
47 | self::FULL => 'FULL',
48 | self::PROJECTION => 'PROJECTION',
49 | self::KEY_ONLY => 'KEY_ONLY',
50 | ];
51 |
52 | public static function name($value)
53 | {
54 | if (!isset(self::$valueToName[$value])) {
55 | throw new UnexpectedValueException(sprintf(
56 | 'Enum %s has no name defined for value %s', __CLASS__, $value));
57 | }
58 | return self::$valueToName[$value];
59 | }
60 |
61 |
62 | public static function value($name)
63 | {
64 | $const = __CLASS__ . '::' . strtoupper($name);
65 | if (!defined($const)) {
66 | throw new UnexpectedValueException(sprintf(
67 | 'Enum %s has no value defined for name %s', __CLASS__, $name));
68 | }
69 | return constant($const);
70 | }
71 | }
72 |
73 | // Adding a class alias for backwards compatibility with the previous class name.
74 | class_alias(ResultType::class, \Google\Cloud\Datastore\V1\EntityResult_ResultType::class);
75 |
76 |
--------------------------------------------------------------------------------
/src/V1/EntityResult_ResultType.php:
--------------------------------------------------------------------------------
1 | google.datastore.v1.ExplainMetrics
15 | */
16 | class ExplainMetrics extends \Google\Protobuf\Internal\Message
17 | {
18 | /**
19 | * Planning phase information for the query.
20 | *
21 | * Generated from protobuf field .google.datastore.v1.PlanSummary plan_summary = 1;
22 | */
23 | private $plan_summary = null;
24 | /**
25 | * Aggregated stats from the execution of the query. Only present when
26 | * [ExplainOptions.analyze][google.datastore.v1.ExplainOptions.analyze] is set
27 | * to true.
28 | *
29 | * Generated from protobuf field .google.datastore.v1.ExecutionStats execution_stats = 2;
30 | */
31 | private $execution_stats = null;
32 |
33 | /**
34 | * Constructor.
35 | *
36 | * @param array $data {
37 | * Optional. Data for populating the Message object.
38 | *
39 | * @type \Google\Cloud\Datastore\V1\PlanSummary $plan_summary
40 | * Planning phase information for the query.
41 | * @type \Google\Cloud\Datastore\V1\ExecutionStats $execution_stats
42 | * Aggregated stats from the execution of the query. Only present when
43 | * [ExplainOptions.analyze][google.datastore.v1.ExplainOptions.analyze] is set
44 | * to true.
45 | * }
46 | */
47 | public function __construct($data = NULL) {
48 | \GPBMetadata\Google\Datastore\V1\QueryProfile::initOnce();
49 | parent::__construct($data);
50 | }
51 |
52 | /**
53 | * Planning phase information for the query.
54 | *
55 | * Generated from protobuf field .google.datastore.v1.PlanSummary plan_summary = 1;
56 | * @return \Google\Cloud\Datastore\V1\PlanSummary|null
57 | */
58 | public function getPlanSummary()
59 | {
60 | return $this->plan_summary;
61 | }
62 |
63 | public function hasPlanSummary()
64 | {
65 | return isset($this->plan_summary);
66 | }
67 |
68 | public function clearPlanSummary()
69 | {
70 | unset($this->plan_summary);
71 | }
72 |
73 | /**
74 | * Planning phase information for the query.
75 | *
76 | * Generated from protobuf field .google.datastore.v1.PlanSummary plan_summary = 1;
77 | * @param \Google\Cloud\Datastore\V1\PlanSummary $var
78 | * @return $this
79 | */
80 | public function setPlanSummary($var)
81 | {
82 | GPBUtil::checkMessage($var, \Google\Cloud\Datastore\V1\PlanSummary::class);
83 | $this->plan_summary = $var;
84 |
85 | return $this;
86 | }
87 |
88 | /**
89 | * Aggregated stats from the execution of the query. Only present when
90 | * [ExplainOptions.analyze][google.datastore.v1.ExplainOptions.analyze] is set
91 | * to true.
92 | *
93 | * Generated from protobuf field .google.datastore.v1.ExecutionStats execution_stats = 2;
94 | * @return \Google\Cloud\Datastore\V1\ExecutionStats|null
95 | */
96 | public function getExecutionStats()
97 | {
98 | return $this->execution_stats;
99 | }
100 |
101 | public function hasExecutionStats()
102 | {
103 | return isset($this->execution_stats);
104 | }
105 |
106 | public function clearExecutionStats()
107 | {
108 | unset($this->execution_stats);
109 | }
110 |
111 | /**
112 | * Aggregated stats from the execution of the query. Only present when
113 | * [ExplainOptions.analyze][google.datastore.v1.ExplainOptions.analyze] is set
114 | * to true.
115 | *
116 | * Generated from protobuf field .google.datastore.v1.ExecutionStats execution_stats = 2;
117 | * @param \Google\Cloud\Datastore\V1\ExecutionStats $var
118 | * @return $this
119 | */
120 | public function setExecutionStats($var)
121 | {
122 | GPBUtil::checkMessage($var, \Google\Cloud\Datastore\V1\ExecutionStats::class);
123 | $this->execution_stats = $var;
124 |
125 | return $this;
126 | }
127 |
128 | }
129 |
130 |
--------------------------------------------------------------------------------
/src/V1/ExplainOptions.php:
--------------------------------------------------------------------------------
1 | google.datastore.v1.ExplainOptions
15 | */
16 | class ExplainOptions extends \Google\Protobuf\Internal\Message
17 | {
18 | /**
19 | * Optional. Whether to execute this query.
20 | * When false (the default), the query will be planned, returning only
21 | * metrics from the planning stages.
22 | * When true, the query will be planned and executed, returning the full
23 | * query results along with both planning and execution stage metrics.
24 | *
25 | * Generated from protobuf field bool analyze = 1 [(.google.api.field_behavior) = OPTIONAL];
26 | */
27 | private $analyze = false;
28 |
29 | /**
30 | * Constructor.
31 | *
32 | * @param array $data {
33 | * Optional. Data for populating the Message object.
34 | *
35 | * @type bool $analyze
36 | * Optional. Whether to execute this query.
37 | * When false (the default), the query will be planned, returning only
38 | * metrics from the planning stages.
39 | * When true, the query will be planned and executed, returning the full
40 | * query results along with both planning and execution stage metrics.
41 | * }
42 | */
43 | public function __construct($data = NULL) {
44 | \GPBMetadata\Google\Datastore\V1\QueryProfile::initOnce();
45 | parent::__construct($data);
46 | }
47 |
48 | /**
49 | * Optional. Whether to execute this query.
50 | * When false (the default), the query will be planned, returning only
51 | * metrics from the planning stages.
52 | * When true, the query will be planned and executed, returning the full
53 | * query results along with both planning and execution stage metrics.
54 | *
55 | * Generated from protobuf field bool analyze = 1 [(.google.api.field_behavior) = OPTIONAL];
56 | * @return bool
57 | */
58 | public function getAnalyze()
59 | {
60 | return $this->analyze;
61 | }
62 |
63 | /**
64 | * Optional. Whether to execute this query.
65 | * When false (the default), the query will be planned, returning only
66 | * metrics from the planning stages.
67 | * When true, the query will be planned and executed, returning the full
68 | * query results along with both planning and execution stage metrics.
69 | *
70 | * Generated from protobuf field bool analyze = 1 [(.google.api.field_behavior) = OPTIONAL];
71 | * @param bool $var
72 | * @return $this
73 | */
74 | public function setAnalyze($var)
75 | {
76 | GPBUtil::checkBool($var);
77 | $this->analyze = $var;
78 |
79 | return $this;
80 | }
81 |
82 | }
83 |
84 |
--------------------------------------------------------------------------------
/src/V1/Filter.php:
--------------------------------------------------------------------------------
1 | google.datastore.v1.Filter
15 | */
16 | class Filter extends \Google\Protobuf\Internal\Message
17 | {
18 | protected $filter_type;
19 |
20 | /**
21 | * Constructor.
22 | *
23 | * @param array $data {
24 | * Optional. Data for populating the Message object.
25 | *
26 | * @type \Google\Cloud\Datastore\V1\CompositeFilter $composite_filter
27 | * A composite filter.
28 | * @type \Google\Cloud\Datastore\V1\PropertyFilter $property_filter
29 | * A filter on a property.
30 | * }
31 | */
32 | public function __construct($data = NULL) {
33 | \GPBMetadata\Google\Datastore\V1\Query::initOnce();
34 | parent::__construct($data);
35 | }
36 |
37 | /**
38 | * A composite filter.
39 | *
40 | * Generated from protobuf field .google.datastore.v1.CompositeFilter composite_filter = 1;
41 | * @return \Google\Cloud\Datastore\V1\CompositeFilter|null
42 | */
43 | public function getCompositeFilter()
44 | {
45 | return $this->readOneof(1);
46 | }
47 |
48 | public function hasCompositeFilter()
49 | {
50 | return $this->hasOneof(1);
51 | }
52 |
53 | /**
54 | * A composite filter.
55 | *
56 | * Generated from protobuf field .google.datastore.v1.CompositeFilter composite_filter = 1;
57 | * @param \Google\Cloud\Datastore\V1\CompositeFilter $var
58 | * @return $this
59 | */
60 | public function setCompositeFilter($var)
61 | {
62 | GPBUtil::checkMessage($var, \Google\Cloud\Datastore\V1\CompositeFilter::class);
63 | $this->writeOneof(1, $var);
64 |
65 | return $this;
66 | }
67 |
68 | /**
69 | * A filter on a property.
70 | *
71 | * Generated from protobuf field .google.datastore.v1.PropertyFilter property_filter = 2;
72 | * @return \Google\Cloud\Datastore\V1\PropertyFilter|null
73 | */
74 | public function getPropertyFilter()
75 | {
76 | return $this->readOneof(2);
77 | }
78 |
79 | public function hasPropertyFilter()
80 | {
81 | return $this->hasOneof(2);
82 | }
83 |
84 | /**
85 | * A filter on a property.
86 | *
87 | * Generated from protobuf field .google.datastore.v1.PropertyFilter property_filter = 2;
88 | * @param \Google\Cloud\Datastore\V1\PropertyFilter $var
89 | * @return $this
90 | */
91 | public function setPropertyFilter($var)
92 | {
93 | GPBUtil::checkMessage($var, \Google\Cloud\Datastore\V1\PropertyFilter::class);
94 | $this->writeOneof(2, $var);
95 |
96 | return $this;
97 | }
98 |
99 | /**
100 | * @return string
101 | */
102 | public function getFilterType()
103 | {
104 | return $this->whichOneof("filter_type");
105 | }
106 |
107 | }
108 |
109 |
--------------------------------------------------------------------------------
/src/V1/FindNearest/DistanceMeasure.php:
--------------------------------------------------------------------------------
1 | google.datastore.v1.FindNearest.DistanceMeasure
13 | */
14 | class DistanceMeasure
15 | {
16 | /**
17 | * Should not be set.
18 | *
19 | * Generated from protobuf enum DISTANCE_MEASURE_UNSPECIFIED = 0;
20 | */
21 | const DISTANCE_MEASURE_UNSPECIFIED = 0;
22 | /**
23 | * Measures the EUCLIDEAN distance between the vectors. See
24 | * [Euclidean](https://en.wikipedia.org/wiki/Euclidean_distance) to learn
25 | * more. The resulting distance decreases the more similar two vectors are.
26 | *
27 | * Generated from protobuf enum EUCLIDEAN = 1;
28 | */
29 | const EUCLIDEAN = 1;
30 | /**
31 | * COSINE distance compares vectors based on the angle between them, which
32 | * allows you to measure similarity that isn't based on the vectors
33 | * magnitude. We recommend using DOT_PRODUCT with unit normalized vectors
34 | * instead of COSINE distance, which is mathematically equivalent with
35 | * better performance. See [Cosine
36 | * Similarity](https://en.wikipedia.org/wiki/Cosine_similarity) to learn
37 | * more about COSINE similarity and COSINE distance. The resulting COSINE
38 | * distance decreases the more similar two vectors are.
39 | *
40 | * Generated from protobuf enum COSINE = 2;
41 | */
42 | const COSINE = 2;
43 | /**
44 | * Similar to cosine but is affected by the magnitude of the vectors. See
45 | * [Dot Product](https://en.wikipedia.org/wiki/Dot_product) to learn more.
46 | * The resulting distance increases the more similar two vectors are.
47 | *
48 | * Generated from protobuf enum DOT_PRODUCT = 3;
49 | */
50 | const DOT_PRODUCT = 3;
51 |
52 | private static $valueToName = [
53 | self::DISTANCE_MEASURE_UNSPECIFIED => 'DISTANCE_MEASURE_UNSPECIFIED',
54 | self::EUCLIDEAN => 'EUCLIDEAN',
55 | self::COSINE => 'COSINE',
56 | self::DOT_PRODUCT => 'DOT_PRODUCT',
57 | ];
58 |
59 | public static function name($value)
60 | {
61 | if (!isset(self::$valueToName[$value])) {
62 | throw new UnexpectedValueException(sprintf(
63 | 'Enum %s has no name defined for value %s', __CLASS__, $value));
64 | }
65 | return self::$valueToName[$value];
66 | }
67 |
68 |
69 | public static function value($name)
70 | {
71 | $const = __CLASS__ . '::' . strtoupper($name);
72 | if (!defined($const)) {
73 | throw new UnexpectedValueException(sprintf(
74 | 'Enum %s has no value defined for name %s', __CLASS__, $name));
75 | }
76 | return constant($const);
77 | }
78 | }
79 |
80 | // Adding a class alias for backwards compatibility with the previous class name.
81 | class_alias(DistanceMeasure::class, \Google\Cloud\Datastore\V1\FindNearest_DistanceMeasure::class);
82 |
83 |
--------------------------------------------------------------------------------
/src/V1/GqlQueryParameter.php:
--------------------------------------------------------------------------------
1 | google.datastore.v1.GqlQueryParameter
15 | */
16 | class GqlQueryParameter extends \Google\Protobuf\Internal\Message
17 | {
18 | protected $parameter_type;
19 |
20 | /**
21 | * Constructor.
22 | *
23 | * @param array $data {
24 | * Optional. Data for populating the Message object.
25 | *
26 | * @type \Google\Cloud\Datastore\V1\Value $value
27 | * A value parameter.
28 | * @type string $cursor
29 | * A query cursor. Query cursors are returned in query
30 | * result batches.
31 | * }
32 | */
33 | public function __construct($data = NULL) {
34 | \GPBMetadata\Google\Datastore\V1\Query::initOnce();
35 | parent::__construct($data);
36 | }
37 |
38 | /**
39 | * A value parameter.
40 | *
41 | * Generated from protobuf field .google.datastore.v1.Value value = 2;
42 | * @return \Google\Cloud\Datastore\V1\Value|null
43 | */
44 | public function getValue()
45 | {
46 | return $this->readOneof(2);
47 | }
48 |
49 | public function hasValue()
50 | {
51 | return $this->hasOneof(2);
52 | }
53 |
54 | /**
55 | * A value parameter.
56 | *
57 | * Generated from protobuf field .google.datastore.v1.Value value = 2;
58 | * @param \Google\Cloud\Datastore\V1\Value $var
59 | * @return $this
60 | */
61 | public function setValue($var)
62 | {
63 | GPBUtil::checkMessage($var, \Google\Cloud\Datastore\V1\Value::class);
64 | $this->writeOneof(2, $var);
65 |
66 | return $this;
67 | }
68 |
69 | /**
70 | * A query cursor. Query cursors are returned in query
71 | * result batches.
72 | *
73 | * Generated from protobuf field bytes cursor = 3;
74 | * @return string
75 | */
76 | public function getCursor()
77 | {
78 | return $this->readOneof(3);
79 | }
80 |
81 | public function hasCursor()
82 | {
83 | return $this->hasOneof(3);
84 | }
85 |
86 | /**
87 | * A query cursor. Query cursors are returned in query
88 | * result batches.
89 | *
90 | * Generated from protobuf field bytes cursor = 3;
91 | * @param string $var
92 | * @return $this
93 | */
94 | public function setCursor($var)
95 | {
96 | GPBUtil::checkString($var, False);
97 | $this->writeOneof(3, $var);
98 |
99 | return $this;
100 | }
101 |
102 | /**
103 | * @return string
104 | */
105 | public function getParameterType()
106 | {
107 | return $this->whichOneof("parameter_type");
108 | }
109 |
110 | }
111 |
112 |
--------------------------------------------------------------------------------
/src/V1/Key_PathElement.php:
--------------------------------------------------------------------------------
1 | google.datastore.v1.KindExpression
15 | */
16 | class KindExpression extends \Google\Protobuf\Internal\Message
17 | {
18 | /**
19 | * The name of the kind.
20 | *
21 | * Generated from protobuf field string name = 1;
22 | */
23 | private $name = '';
24 |
25 | /**
26 | * Constructor.
27 | *
28 | * @param array $data {
29 | * Optional. Data for populating the Message object.
30 | *
31 | * @type string $name
32 | * The name of the kind.
33 | * }
34 | */
35 | public function __construct($data = NULL) {
36 | \GPBMetadata\Google\Datastore\V1\Query::initOnce();
37 | parent::__construct($data);
38 | }
39 |
40 | /**
41 | * The name of the kind.
42 | *
43 | * Generated from protobuf field string name = 1;
44 | * @return string
45 | */
46 | public function getName()
47 | {
48 | return $this->name;
49 | }
50 |
51 | /**
52 | * The name of the kind.
53 | *
54 | * Generated from protobuf field string name = 1;
55 | * @param string $var
56 | * @return $this
57 | */
58 | public function setName($var)
59 | {
60 | GPBUtil::checkString($var, True);
61 | $this->name = $var;
62 |
63 | return $this;
64 | }
65 |
66 | }
67 |
68 |
--------------------------------------------------------------------------------
/src/V1/Mutation/ConflictResolutionStrategy.php:
--------------------------------------------------------------------------------
1 | google.datastore.v1.Mutation.ConflictResolutionStrategy
13 | */
14 | class ConflictResolutionStrategy
15 | {
16 | /**
17 | * Unspecified. Defaults to `SERVER_VALUE`.
18 | *
19 | * Generated from protobuf enum STRATEGY_UNSPECIFIED = 0;
20 | */
21 | const STRATEGY_UNSPECIFIED = 0;
22 | /**
23 | * The server entity is kept.
24 | *
25 | * Generated from protobuf enum SERVER_VALUE = 1;
26 | */
27 | const SERVER_VALUE = 1;
28 | /**
29 | * The whole commit request fails.
30 | *
31 | * Generated from protobuf enum FAIL = 3;
32 | */
33 | const FAIL = 3;
34 |
35 | private static $valueToName = [
36 | self::STRATEGY_UNSPECIFIED => 'STRATEGY_UNSPECIFIED',
37 | self::SERVER_VALUE => 'SERVER_VALUE',
38 | self::FAIL => 'FAIL',
39 | ];
40 |
41 | public static function name($value)
42 | {
43 | if (!isset(self::$valueToName[$value])) {
44 | throw new UnexpectedValueException(sprintf(
45 | 'Enum %s has no name defined for value %s', __CLASS__, $value));
46 | }
47 | return self::$valueToName[$value];
48 | }
49 |
50 |
51 | public static function value($name)
52 | {
53 | $const = __CLASS__ . '::' . strtoupper($name);
54 | if (!defined($const)) {
55 | throw new UnexpectedValueException(sprintf(
56 | 'Enum %s has no value defined for name %s', __CLASS__, $name));
57 | }
58 | return constant($const);
59 | }
60 | }
61 |
62 | // Adding a class alias for backwards compatibility with the previous class name.
63 | class_alias(ConflictResolutionStrategy::class, \Google\Cloud\Datastore\V1\Mutation_ConflictResolutionStrategy::class);
64 |
65 |
--------------------------------------------------------------------------------
/src/V1/PartitionId.php:
--------------------------------------------------------------------------------
1 | google.datastore.v1.PartitionId
30 | */
31 | class PartitionId extends \Google\Protobuf\Internal\Message
32 | {
33 | /**
34 | * The ID of the project to which the entities belong.
35 | *
36 | * Generated from protobuf field string project_id = 2;
37 | */
38 | private $project_id = '';
39 | /**
40 | * If not empty, the ID of the database to which the entities
41 | * belong.
42 | *
43 | * Generated from protobuf field string database_id = 3;
44 | */
45 | private $database_id = '';
46 | /**
47 | * If not empty, the ID of the namespace to which the entities belong.
48 | *
49 | * Generated from protobuf field string namespace_id = 4;
50 | */
51 | private $namespace_id = '';
52 |
53 | /**
54 | * Constructor.
55 | *
56 | * @param array $data {
57 | * Optional. Data for populating the Message object.
58 | *
59 | * @type string $project_id
60 | * The ID of the project to which the entities belong.
61 | * @type string $database_id
62 | * If not empty, the ID of the database to which the entities
63 | * belong.
64 | * @type string $namespace_id
65 | * If not empty, the ID of the namespace to which the entities belong.
66 | * }
67 | */
68 | public function __construct($data = NULL) {
69 | \GPBMetadata\Google\Datastore\V1\Entity::initOnce();
70 | parent::__construct($data);
71 | }
72 |
73 | /**
74 | * The ID of the project to which the entities belong.
75 | *
76 | * Generated from protobuf field string project_id = 2;
77 | * @return string
78 | */
79 | public function getProjectId()
80 | {
81 | return $this->project_id;
82 | }
83 |
84 | /**
85 | * The ID of the project to which the entities belong.
86 | *
87 | * Generated from protobuf field string project_id = 2;
88 | * @param string $var
89 | * @return $this
90 | */
91 | public function setProjectId($var)
92 | {
93 | GPBUtil::checkString($var, True);
94 | $this->project_id = $var;
95 |
96 | return $this;
97 | }
98 |
99 | /**
100 | * If not empty, the ID of the database to which the entities
101 | * belong.
102 | *
103 | * Generated from protobuf field string database_id = 3;
104 | * @return string
105 | */
106 | public function getDatabaseId()
107 | {
108 | return $this->database_id;
109 | }
110 |
111 | /**
112 | * If not empty, the ID of the database to which the entities
113 | * belong.
114 | *
115 | * Generated from protobuf field string database_id = 3;
116 | * @param string $var
117 | * @return $this
118 | */
119 | public function setDatabaseId($var)
120 | {
121 | GPBUtil::checkString($var, True);
122 | $this->database_id = $var;
123 |
124 | return $this;
125 | }
126 |
127 | /**
128 | * If not empty, the ID of the namespace to which the entities belong.
129 | *
130 | * Generated from protobuf field string namespace_id = 4;
131 | * @return string
132 | */
133 | public function getNamespaceId()
134 | {
135 | return $this->namespace_id;
136 | }
137 |
138 | /**
139 | * If not empty, the ID of the namespace to which the entities belong.
140 | *
141 | * Generated from protobuf field string namespace_id = 4;
142 | * @param string $var
143 | * @return $this
144 | */
145 | public function setNamespaceId($var)
146 | {
147 | GPBUtil::checkString($var, True);
148 | $this->namespace_id = $var;
149 |
150 | return $this;
151 | }
152 |
153 | }
154 |
155 |
--------------------------------------------------------------------------------
/src/V1/PlanSummary.php:
--------------------------------------------------------------------------------
1 | google.datastore.v1.PlanSummary
15 | */
16 | class PlanSummary extends \Google\Protobuf\Internal\Message
17 | {
18 | /**
19 | * The indexes selected for the query. For example:
20 | * [
21 | * {"query_scope": "Collection", "properties": "(foo ASC, __name__ ASC)"},
22 | * {"query_scope": "Collection", "properties": "(bar ASC, __name__ ASC)"}
23 | * ]
24 | *
25 | * Generated from protobuf field repeated .google.protobuf.Struct indexes_used = 1;
26 | */
27 | private $indexes_used;
28 |
29 | /**
30 | * Constructor.
31 | *
32 | * @param array $data {
33 | * Optional. Data for populating the Message object.
34 | *
35 | * @type array<\Google\Protobuf\Struct>|\Google\Protobuf\Internal\RepeatedField $indexes_used
36 | * The indexes selected for the query. For example:
37 | * [
38 | * {"query_scope": "Collection", "properties": "(foo ASC, __name__ ASC)"},
39 | * {"query_scope": "Collection", "properties": "(bar ASC, __name__ ASC)"}
40 | * ]
41 | * }
42 | */
43 | public function __construct($data = NULL) {
44 | \GPBMetadata\Google\Datastore\V1\QueryProfile::initOnce();
45 | parent::__construct($data);
46 | }
47 |
48 | /**
49 | * The indexes selected for the query. For example:
50 | * [
51 | * {"query_scope": "Collection", "properties": "(foo ASC, __name__ ASC)"},
52 | * {"query_scope": "Collection", "properties": "(bar ASC, __name__ ASC)"}
53 | * ]
54 | *
55 | * Generated from protobuf field repeated .google.protobuf.Struct indexes_used = 1;
56 | * @return \Google\Protobuf\Internal\RepeatedField
57 | */
58 | public function getIndexesUsed()
59 | {
60 | return $this->indexes_used;
61 | }
62 |
63 | /**
64 | * The indexes selected for the query. For example:
65 | * [
66 | * {"query_scope": "Collection", "properties": "(foo ASC, __name__ ASC)"},
67 | * {"query_scope": "Collection", "properties": "(bar ASC, __name__ ASC)"}
68 | * ]
69 | *
70 | * Generated from protobuf field repeated .google.protobuf.Struct indexes_used = 1;
71 | * @param array<\Google\Protobuf\Struct>|\Google\Protobuf\Internal\RepeatedField $var
72 | * @return $this
73 | */
74 | public function setIndexesUsed($var)
75 | {
76 | $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Struct::class);
77 | $this->indexes_used = $arr;
78 |
79 | return $this;
80 | }
81 |
82 | }
83 |
84 |
--------------------------------------------------------------------------------
/src/V1/Projection.php:
--------------------------------------------------------------------------------
1 | google.datastore.v1.Projection
15 | */
16 | class Projection extends \Google\Protobuf\Internal\Message
17 | {
18 | /**
19 | * The property to project.
20 | *
21 | * Generated from protobuf field .google.datastore.v1.PropertyReference property = 1;
22 | */
23 | private $property = null;
24 |
25 | /**
26 | * Constructor.
27 | *
28 | * @param array $data {
29 | * Optional. Data for populating the Message object.
30 | *
31 | * @type \Google\Cloud\Datastore\V1\PropertyReference $property
32 | * The property to project.
33 | * }
34 | */
35 | public function __construct($data = NULL) {
36 | \GPBMetadata\Google\Datastore\V1\Query::initOnce();
37 | parent::__construct($data);
38 | }
39 |
40 | /**
41 | * The property to project.
42 | *
43 | * Generated from protobuf field .google.datastore.v1.PropertyReference property = 1;
44 | * @return \Google\Cloud\Datastore\V1\PropertyReference|null
45 | */
46 | public function getProperty()
47 | {
48 | return $this->property;
49 | }
50 |
51 | public function hasProperty()
52 | {
53 | return isset($this->property);
54 | }
55 |
56 | public function clearProperty()
57 | {
58 | unset($this->property);
59 | }
60 |
61 | /**
62 | * The property to project.
63 | *
64 | * Generated from protobuf field .google.datastore.v1.PropertyReference property = 1;
65 | * @param \Google\Cloud\Datastore\V1\PropertyReference $var
66 | * @return $this
67 | */
68 | public function setProperty($var)
69 | {
70 | GPBUtil::checkMessage($var, \Google\Cloud\Datastore\V1\PropertyReference::class);
71 | $this->property = $var;
72 |
73 | return $this;
74 | }
75 |
76 | }
77 |
78 |
--------------------------------------------------------------------------------
/src/V1/PropertyFilter.php:
--------------------------------------------------------------------------------
1 | google.datastore.v1.PropertyFilter
15 | */
16 | class PropertyFilter extends \Google\Protobuf\Internal\Message
17 | {
18 | /**
19 | * The property to filter by.
20 | *
21 | * Generated from protobuf field .google.datastore.v1.PropertyReference property = 1;
22 | */
23 | private $property = null;
24 | /**
25 | * The operator to filter by.
26 | *
27 | * Generated from protobuf field .google.datastore.v1.PropertyFilter.Operator op = 2;
28 | */
29 | private $op = 0;
30 | /**
31 | * The value to compare the property to.
32 | *
33 | * Generated from protobuf field .google.datastore.v1.Value value = 3;
34 | */
35 | private $value = null;
36 |
37 | /**
38 | * Constructor.
39 | *
40 | * @param array $data {
41 | * Optional. Data for populating the Message object.
42 | *
43 | * @type \Google\Cloud\Datastore\V1\PropertyReference $property
44 | * The property to filter by.
45 | * @type int $op
46 | * The operator to filter by.
47 | * @type \Google\Cloud\Datastore\V1\Value $value
48 | * The value to compare the property to.
49 | * }
50 | */
51 | public function __construct($data = NULL) {
52 | \GPBMetadata\Google\Datastore\V1\Query::initOnce();
53 | parent::__construct($data);
54 | }
55 |
56 | /**
57 | * The property to filter by.
58 | *
59 | * Generated from protobuf field .google.datastore.v1.PropertyReference property = 1;
60 | * @return \Google\Cloud\Datastore\V1\PropertyReference|null
61 | */
62 | public function getProperty()
63 | {
64 | return $this->property;
65 | }
66 |
67 | public function hasProperty()
68 | {
69 | return isset($this->property);
70 | }
71 |
72 | public function clearProperty()
73 | {
74 | unset($this->property);
75 | }
76 |
77 | /**
78 | * The property to filter by.
79 | *
80 | * Generated from protobuf field .google.datastore.v1.PropertyReference property = 1;
81 | * @param \Google\Cloud\Datastore\V1\PropertyReference $var
82 | * @return $this
83 | */
84 | public function setProperty($var)
85 | {
86 | GPBUtil::checkMessage($var, \Google\Cloud\Datastore\V1\PropertyReference::class);
87 | $this->property = $var;
88 |
89 | return $this;
90 | }
91 |
92 | /**
93 | * The operator to filter by.
94 | *
95 | * Generated from protobuf field .google.datastore.v1.PropertyFilter.Operator op = 2;
96 | * @return int
97 | */
98 | public function getOp()
99 | {
100 | return $this->op;
101 | }
102 |
103 | /**
104 | * The operator to filter by.
105 | *
106 | * Generated from protobuf field .google.datastore.v1.PropertyFilter.Operator op = 2;
107 | * @param int $var
108 | * @return $this
109 | */
110 | public function setOp($var)
111 | {
112 | GPBUtil::checkEnum($var, \Google\Cloud\Datastore\V1\PropertyFilter\Operator::class);
113 | $this->op = $var;
114 |
115 | return $this;
116 | }
117 |
118 | /**
119 | * The value to compare the property to.
120 | *
121 | * Generated from protobuf field .google.datastore.v1.Value value = 3;
122 | * @return \Google\Cloud\Datastore\V1\Value|null
123 | */
124 | public function getValue()
125 | {
126 | return $this->value;
127 | }
128 |
129 | public function hasValue()
130 | {
131 | return isset($this->value);
132 | }
133 |
134 | public function clearValue()
135 | {
136 | unset($this->value);
137 | }
138 |
139 | /**
140 | * The value to compare the property to.
141 | *
142 | * Generated from protobuf field .google.datastore.v1.Value value = 3;
143 | * @param \Google\Cloud\Datastore\V1\Value $var
144 | * @return $this
145 | */
146 | public function setValue($var)
147 | {
148 | GPBUtil::checkMessage($var, \Google\Cloud\Datastore\V1\Value::class);
149 | $this->value = $var;
150 |
151 | return $this;
152 | }
153 |
154 | }
155 |
156 |
--------------------------------------------------------------------------------
/src/V1/PropertyFilter/Operator.php:
--------------------------------------------------------------------------------
1 | google.datastore.v1.PropertyFilter.Operator
13 | */
14 | class Operator
15 | {
16 | /**
17 | * Unspecified. This value must not be used.
18 | *
19 | * Generated from protobuf enum OPERATOR_UNSPECIFIED = 0;
20 | */
21 | const OPERATOR_UNSPECIFIED = 0;
22 | /**
23 | * The given `property` is less than the given `value`.
24 | * Requires:
25 | * * That `property` comes first in `order_by`.
26 | *
27 | * Generated from protobuf enum LESS_THAN = 1;
28 | */
29 | const LESS_THAN = 1;
30 | /**
31 | * The given `property` is less than or equal to the given `value`.
32 | * Requires:
33 | * * That `property` comes first in `order_by`.
34 | *
35 | * Generated from protobuf enum LESS_THAN_OR_EQUAL = 2;
36 | */
37 | const LESS_THAN_OR_EQUAL = 2;
38 | /**
39 | * The given `property` is greater than the given `value`.
40 | * Requires:
41 | * * That `property` comes first in `order_by`.
42 | *
43 | * Generated from protobuf enum GREATER_THAN = 3;
44 | */
45 | const GREATER_THAN = 3;
46 | /**
47 | * The given `property` is greater than or equal to the given `value`.
48 | * Requires:
49 | * * That `property` comes first in `order_by`.
50 | *
51 | * Generated from protobuf enum GREATER_THAN_OR_EQUAL = 4;
52 | */
53 | const GREATER_THAN_OR_EQUAL = 4;
54 | /**
55 | * The given `property` is equal to the given `value`.
56 | *
57 | * Generated from protobuf enum EQUAL = 5;
58 | */
59 | const EQUAL = 5;
60 | /**
61 | * The given `property` is equal to at least one value in the given array.
62 | * Requires:
63 | * * That `value` is a non-empty `ArrayValue`, subject to disjunction
64 | * limits.
65 | * * No `NOT_IN` is in the same query.
66 | *
67 | * Generated from protobuf enum IN = 6;
68 | */
69 | const IN = 6;
70 | /**
71 | * The given `property` is not equal to the given `value`.
72 | * Requires:
73 | * * No other `NOT_EQUAL` or `NOT_IN` is in the same query.
74 | * * That `property` comes first in the `order_by`.
75 | *
76 | * Generated from protobuf enum NOT_EQUAL = 9;
77 | */
78 | const NOT_EQUAL = 9;
79 | /**
80 | * Limit the result set to the given entity and its descendants.
81 | * Requires:
82 | * * That `value` is an entity key.
83 | * * All evaluated disjunctions must have the same `HAS_ANCESTOR` filter.
84 | *
85 | * Generated from protobuf enum HAS_ANCESTOR = 11;
86 | */
87 | const HAS_ANCESTOR = 11;
88 | /**
89 | * The value of the `property` is not in the given array.
90 | * Requires:
91 | * * That `value` is a non-empty `ArrayValue` with at most 10 values.
92 | * * No other `OR`, `IN`, `NOT_IN`, `NOT_EQUAL` is in the same query.
93 | * * That `field` comes first in the `order_by`.
94 | *
95 | * Generated from protobuf enum NOT_IN = 13;
96 | */
97 | const NOT_IN = 13;
98 |
99 | private static $valueToName = [
100 | self::OPERATOR_UNSPECIFIED => 'OPERATOR_UNSPECIFIED',
101 | self::LESS_THAN => 'LESS_THAN',
102 | self::LESS_THAN_OR_EQUAL => 'LESS_THAN_OR_EQUAL',
103 | self::GREATER_THAN => 'GREATER_THAN',
104 | self::GREATER_THAN_OR_EQUAL => 'GREATER_THAN_OR_EQUAL',
105 | self::EQUAL => 'EQUAL',
106 | self::IN => 'IN',
107 | self::NOT_EQUAL => 'NOT_EQUAL',
108 | self::HAS_ANCESTOR => 'HAS_ANCESTOR',
109 | self::NOT_IN => 'NOT_IN',
110 | ];
111 |
112 | public static function name($value)
113 | {
114 | if (!isset(self::$valueToName[$value])) {
115 | throw new UnexpectedValueException(sprintf(
116 | 'Enum %s has no name defined for value %s', __CLASS__, $value));
117 | }
118 | return self::$valueToName[$value];
119 | }
120 |
121 |
122 | public static function value($name)
123 | {
124 | $const = __CLASS__ . '::' . strtoupper($name);
125 | if (!defined($const)) {
126 | throw new UnexpectedValueException(sprintf(
127 | 'Enum %s has no value defined for name %s', __CLASS__, $name));
128 | }
129 | return constant($const);
130 | }
131 | }
132 |
133 | // Adding a class alias for backwards compatibility with the previous class name.
134 | class_alias(Operator::class, \Google\Cloud\Datastore\V1\PropertyFilter_Operator::class);
135 |
136 |
--------------------------------------------------------------------------------
/src/V1/PropertyFilter_Operator.php:
--------------------------------------------------------------------------------
1 | google.datastore.v1.PropertyMask
16 | */
17 | class PropertyMask extends \Google\Protobuf\Internal\Message
18 | {
19 | /**
20 | * The paths to the properties covered by this mask.
21 | * A path is a list of property names separated by dots (`.`), for example
22 | * `foo.bar` means the property `bar` inside the entity property `foo` inside
23 | * the entity associated with this path.
24 | * If a property name contains a dot `.` or a backslash `\`, then that
25 | * name must be escaped.
26 | * A path must not be empty, and may not reference a value inside an
27 | * [array value][google.datastore.v1.Value.array_value].
28 | *
29 | * Generated from protobuf field repeated string paths = 1;
30 | */
31 | private $paths;
32 |
33 | /**
34 | * Constructor.
35 | *
36 | * @param array $data {
37 | * Optional. Data for populating the Message object.
38 | *
39 | * @type array|\Google\Protobuf\Internal\RepeatedField $paths
40 | * The paths to the properties covered by this mask.
41 | * A path is a list of property names separated by dots (`.`), for example
42 | * `foo.bar` means the property `bar` inside the entity property `foo` inside
43 | * the entity associated with this path.
44 | * If a property name contains a dot `.` or a backslash `\`, then that
45 | * name must be escaped.
46 | * A path must not be empty, and may not reference a value inside an
47 | * [array value][google.datastore.v1.Value.array_value].
48 | * }
49 | */
50 | public function __construct($data = NULL) {
51 | \GPBMetadata\Google\Datastore\V1\Datastore::initOnce();
52 | parent::__construct($data);
53 | }
54 |
55 | /**
56 | * The paths to the properties covered by this mask.
57 | * A path is a list of property names separated by dots (`.`), for example
58 | * `foo.bar` means the property `bar` inside the entity property `foo` inside
59 | * the entity associated with this path.
60 | * If a property name contains a dot `.` or a backslash `\`, then that
61 | * name must be escaped.
62 | * A path must not be empty, and may not reference a value inside an
63 | * [array value][google.datastore.v1.Value.array_value].
64 | *
65 | * Generated from protobuf field repeated string paths = 1;
66 | * @return \Google\Protobuf\Internal\RepeatedField
67 | */
68 | public function getPaths()
69 | {
70 | return $this->paths;
71 | }
72 |
73 | /**
74 | * The paths to the properties covered by this mask.
75 | * A path is a list of property names separated by dots (`.`), for example
76 | * `foo.bar` means the property `bar` inside the entity property `foo` inside
77 | * the entity associated with this path.
78 | * If a property name contains a dot `.` or a backslash `\`, then that
79 | * name must be escaped.
80 | * A path must not be empty, and may not reference a value inside an
81 | * [array value][google.datastore.v1.Value.array_value].
82 | *
83 | * Generated from protobuf field repeated string paths = 1;
84 | * @param array|\Google\Protobuf\Internal\RepeatedField $var
85 | * @return $this
86 | */
87 | public function setPaths($var)
88 | {
89 | $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING);
90 | $this->paths = $arr;
91 |
92 | return $this;
93 | }
94 |
95 | }
96 |
97 |
--------------------------------------------------------------------------------
/src/V1/PropertyOrder.php:
--------------------------------------------------------------------------------
1 | google.datastore.v1.PropertyOrder
15 | */
16 | class PropertyOrder extends \Google\Protobuf\Internal\Message
17 | {
18 | /**
19 | * The property to order by.
20 | *
21 | * Generated from protobuf field .google.datastore.v1.PropertyReference property = 1;
22 | */
23 | private $property = null;
24 | /**
25 | * The direction to order by. Defaults to `ASCENDING`.
26 | *
27 | * Generated from protobuf field .google.datastore.v1.PropertyOrder.Direction direction = 2;
28 | */
29 | private $direction = 0;
30 |
31 | /**
32 | * Constructor.
33 | *
34 | * @param array $data {
35 | * Optional. Data for populating the Message object.
36 | *
37 | * @type \Google\Cloud\Datastore\V1\PropertyReference $property
38 | * The property to order by.
39 | * @type int $direction
40 | * The direction to order by. Defaults to `ASCENDING`.
41 | * }
42 | */
43 | public function __construct($data = NULL) {
44 | \GPBMetadata\Google\Datastore\V1\Query::initOnce();
45 | parent::__construct($data);
46 | }
47 |
48 | /**
49 | * The property to order by.
50 | *
51 | * Generated from protobuf field .google.datastore.v1.PropertyReference property = 1;
52 | * @return \Google\Cloud\Datastore\V1\PropertyReference|null
53 | */
54 | public function getProperty()
55 | {
56 | return $this->property;
57 | }
58 |
59 | public function hasProperty()
60 | {
61 | return isset($this->property);
62 | }
63 |
64 | public function clearProperty()
65 | {
66 | unset($this->property);
67 | }
68 |
69 | /**
70 | * The property to order by.
71 | *
72 | * Generated from protobuf field .google.datastore.v1.PropertyReference property = 1;
73 | * @param \Google\Cloud\Datastore\V1\PropertyReference $var
74 | * @return $this
75 | */
76 | public function setProperty($var)
77 | {
78 | GPBUtil::checkMessage($var, \Google\Cloud\Datastore\V1\PropertyReference::class);
79 | $this->property = $var;
80 |
81 | return $this;
82 | }
83 |
84 | /**
85 | * The direction to order by. Defaults to `ASCENDING`.
86 | *
87 | * Generated from protobuf field .google.datastore.v1.PropertyOrder.Direction direction = 2;
88 | * @return int
89 | */
90 | public function getDirection()
91 | {
92 | return $this->direction;
93 | }
94 |
95 | /**
96 | * The direction to order by. Defaults to `ASCENDING`.
97 | *
98 | * Generated from protobuf field .google.datastore.v1.PropertyOrder.Direction direction = 2;
99 | * @param int $var
100 | * @return $this
101 | */
102 | public function setDirection($var)
103 | {
104 | GPBUtil::checkEnum($var, \Google\Cloud\Datastore\V1\PropertyOrder\Direction::class);
105 | $this->direction = $var;
106 |
107 | return $this;
108 | }
109 |
110 | }
111 |
112 |
--------------------------------------------------------------------------------
/src/V1/PropertyOrder/Direction.php:
--------------------------------------------------------------------------------
1 | google.datastore.v1.PropertyOrder.Direction
13 | */
14 | class Direction
15 | {
16 | /**
17 | * Unspecified. This value must not be used.
18 | *
19 | * Generated from protobuf enum DIRECTION_UNSPECIFIED = 0;
20 | */
21 | const DIRECTION_UNSPECIFIED = 0;
22 | /**
23 | * Ascending.
24 | *
25 | * Generated from protobuf enum ASCENDING = 1;
26 | */
27 | const ASCENDING = 1;
28 | /**
29 | * Descending.
30 | *
31 | * Generated from protobuf enum DESCENDING = 2;
32 | */
33 | const DESCENDING = 2;
34 |
35 | private static $valueToName = [
36 | self::DIRECTION_UNSPECIFIED => 'DIRECTION_UNSPECIFIED',
37 | self::ASCENDING => 'ASCENDING',
38 | self::DESCENDING => 'DESCENDING',
39 | ];
40 |
41 | public static function name($value)
42 | {
43 | if (!isset(self::$valueToName[$value])) {
44 | throw new UnexpectedValueException(sprintf(
45 | 'Enum %s has no name defined for value %s', __CLASS__, $value));
46 | }
47 | return self::$valueToName[$value];
48 | }
49 |
50 |
51 | public static function value($name)
52 | {
53 | $const = __CLASS__ . '::' . strtoupper($name);
54 | if (!defined($const)) {
55 | throw new UnexpectedValueException(sprintf(
56 | 'Enum %s has no value defined for name %s', __CLASS__, $name));
57 | }
58 | return constant($const);
59 | }
60 | }
61 |
62 | // Adding a class alias for backwards compatibility with the previous class name.
63 | class_alias(Direction::class, \Google\Cloud\Datastore\V1\PropertyOrder_Direction::class);
64 |
65 |
--------------------------------------------------------------------------------
/src/V1/PropertyOrder_Direction.php:
--------------------------------------------------------------------------------
1 | google.datastore.v1.PropertyReference
15 | */
16 | class PropertyReference extends \Google\Protobuf\Internal\Message
17 | {
18 | /**
19 | * A reference to a property.
20 | * Requires:
21 | * * MUST be a dot-delimited (`.`) string of segments, where each segment
22 | * conforms to [entity property name][google.datastore.v1.Entity.properties]
23 | * limitations.
24 | *
25 | * Generated from protobuf field string name = 2;
26 | */
27 | private $name = '';
28 |
29 | /**
30 | * Constructor.
31 | *
32 | * @param array $data {
33 | * Optional. Data for populating the Message object.
34 | *
35 | * @type string $name
36 | * A reference to a property.
37 | * Requires:
38 | * * MUST be a dot-delimited (`.`) string of segments, where each segment
39 | * conforms to [entity property name][google.datastore.v1.Entity.properties]
40 | * limitations.
41 | * }
42 | */
43 | public function __construct($data = NULL) {
44 | \GPBMetadata\Google\Datastore\V1\Query::initOnce();
45 | parent::__construct($data);
46 | }
47 |
48 | /**
49 | * A reference to a property.
50 | * Requires:
51 | * * MUST be a dot-delimited (`.`) string of segments, where each segment
52 | * conforms to [entity property name][google.datastore.v1.Entity.properties]
53 | * limitations.
54 | *
55 | * Generated from protobuf field string name = 2;
56 | * @return string
57 | */
58 | public function getName()
59 | {
60 | return $this->name;
61 | }
62 |
63 | /**
64 | * A reference to a property.
65 | * Requires:
66 | * * MUST be a dot-delimited (`.`) string of segments, where each segment
67 | * conforms to [entity property name][google.datastore.v1.Entity.properties]
68 | * limitations.
69 | *
70 | * Generated from protobuf field string name = 2;
71 | * @param string $var
72 | * @return $this
73 | */
74 | public function setName($var)
75 | {
76 | GPBUtil::checkString($var, True);
77 | $this->name = $var;
78 |
79 | return $this;
80 | }
81 |
82 | }
83 |
84 |
--------------------------------------------------------------------------------
/src/V1/PropertyTransform/ServerValue.php:
--------------------------------------------------------------------------------
1 | google.datastore.v1.PropertyTransform.ServerValue
13 | */
14 | class ServerValue
15 | {
16 | /**
17 | * Unspecified. This value must not be used.
18 | *
19 | * Generated from protobuf enum SERVER_VALUE_UNSPECIFIED = 0;
20 | */
21 | const SERVER_VALUE_UNSPECIFIED = 0;
22 | /**
23 | * The time at which the server processed the request, with millisecond
24 | * precision. If used on multiple properties (same or different entities)
25 | * in a transaction, all the properties will get the same server timestamp.
26 | *
27 | * Generated from protobuf enum REQUEST_TIME = 1;
28 | */
29 | const REQUEST_TIME = 1;
30 |
31 | private static $valueToName = [
32 | self::SERVER_VALUE_UNSPECIFIED => 'SERVER_VALUE_UNSPECIFIED',
33 | self::REQUEST_TIME => 'REQUEST_TIME',
34 | ];
35 |
36 | public static function name($value)
37 | {
38 | if (!isset(self::$valueToName[$value])) {
39 | throw new UnexpectedValueException(sprintf(
40 | 'Enum %s has no name defined for value %s', __CLASS__, $value));
41 | }
42 | return self::$valueToName[$value];
43 | }
44 |
45 |
46 | public static function value($name)
47 | {
48 | $const = __CLASS__ . '::' . strtoupper($name);
49 | if (!defined($const)) {
50 | throw new UnexpectedValueException(sprintf(
51 | 'Enum %s has no value defined for name %s', __CLASS__, $name));
52 | }
53 | return constant($const);
54 | }
55 | }
56 |
57 | // Adding a class alias for backwards compatibility with the previous class name.
58 | class_alias(ServerValue::class, \Google\Cloud\Datastore\V1\PropertyTransform_ServerValue::class);
59 |
60 |
--------------------------------------------------------------------------------
/src/V1/QueryMode.php:
--------------------------------------------------------------------------------
1 | google.datastore.v1.QueryMode
13 | */
14 | class QueryMode
15 | {
16 | /**
17 | * The default mode. Only the query results are returned.
18 | *
19 | * Generated from protobuf enum NORMAL = 0;
20 | */
21 | const NORMAL = 0;
22 | /**
23 | * This mode returns only the query plan, without any results or execution
24 | * statistics information.
25 | *
26 | * Generated from protobuf enum PLAN = 1;
27 | */
28 | const PLAN = 1;
29 | /**
30 | * This mode returns both the query plan and the execution statistics along
31 | * with the results.
32 | *
33 | * Generated from protobuf enum PROFILE = 2;
34 | */
35 | const PROFILE = 2;
36 |
37 | private static $valueToName = [
38 | self::NORMAL => 'NORMAL',
39 | self::PLAN => 'PLAN',
40 | self::PROFILE => 'PROFILE',
41 | ];
42 |
43 | public static function name($value)
44 | {
45 | if (!isset(self::$valueToName[$value])) {
46 | throw new UnexpectedValueException(sprintf(
47 | 'Enum %s has no name defined for value %s', __CLASS__, $value));
48 | }
49 | return self::$valueToName[$value];
50 | }
51 |
52 |
53 | public static function value($name)
54 | {
55 | $const = __CLASS__ . '::' . strtoupper($name);
56 | if (!defined($const)) {
57 | throw new UnexpectedValueException(sprintf(
58 | 'Enum %s has no value defined for name %s', __CLASS__, $name));
59 | }
60 | return constant($const);
61 | }
62 | }
63 |
64 |
--------------------------------------------------------------------------------
/src/V1/QueryPlan.php:
--------------------------------------------------------------------------------
1 | google.datastore.v1.QueryPlan
15 | */
16 | class QueryPlan extends \Google\Protobuf\Internal\Message
17 | {
18 | /**
19 | * Planning phase information for the query. It will include:
20 | * {
21 | * "indexes_used": [
22 | * {"query_scope": "Collection", "properties": "(foo ASC, __name__ ASC)"},
23 | * {"query_scope": "Collection", "properties": "(bar ASC, __name__ ASC)"}
24 | * ]
25 | * }
26 | *
27 | * Generated from protobuf field .google.protobuf.Struct plan_info = 1;
28 | */
29 | private $plan_info = null;
30 |
31 | /**
32 | * Constructor.
33 | *
34 | * @param array $data {
35 | * Optional. Data for populating the Message object.
36 | *
37 | * @type \Google\Protobuf\Struct $plan_info
38 | * Planning phase information for the query. It will include:
39 | * {
40 | * "indexes_used": [
41 | * {"query_scope": "Collection", "properties": "(foo ASC, __name__ ASC)"},
42 | * {"query_scope": "Collection", "properties": "(bar ASC, __name__ ASC)"}
43 | * ]
44 | * }
45 | * }
46 | */
47 | public function __construct($data = NULL) {
48 | \GPBMetadata\Google\Datastore\V1\QueryProfile::initOnce();
49 | parent::__construct($data);
50 | }
51 |
52 | /**
53 | * Planning phase information for the query. It will include:
54 | * {
55 | * "indexes_used": [
56 | * {"query_scope": "Collection", "properties": "(foo ASC, __name__ ASC)"},
57 | * {"query_scope": "Collection", "properties": "(bar ASC, __name__ ASC)"}
58 | * ]
59 | * }
60 | *
61 | * Generated from protobuf field .google.protobuf.Struct plan_info = 1;
62 | * @return \Google\Protobuf\Struct|null
63 | */
64 | public function getPlanInfo()
65 | {
66 | return $this->plan_info;
67 | }
68 |
69 | public function hasPlanInfo()
70 | {
71 | return isset($this->plan_info);
72 | }
73 |
74 | public function clearPlanInfo()
75 | {
76 | unset($this->plan_info);
77 | }
78 |
79 | /**
80 | * Planning phase information for the query. It will include:
81 | * {
82 | * "indexes_used": [
83 | * {"query_scope": "Collection", "properties": "(foo ASC, __name__ ASC)"},
84 | * {"query_scope": "Collection", "properties": "(bar ASC, __name__ ASC)"}
85 | * ]
86 | * }
87 | *
88 | * Generated from protobuf field .google.protobuf.Struct plan_info = 1;
89 | * @param \Google\Protobuf\Struct $var
90 | * @return $this
91 | */
92 | public function setPlanInfo($var)
93 | {
94 | GPBUtil::checkMessage($var, \Google\Protobuf\Struct::class);
95 | $this->plan_info = $var;
96 |
97 | return $this;
98 | }
99 |
100 | }
101 |
102 |
--------------------------------------------------------------------------------
/src/V1/QueryResultBatch/MoreResultsType.php:
--------------------------------------------------------------------------------
1 | google.datastore.v1.QueryResultBatch.MoreResultsType
13 | */
14 | class MoreResultsType
15 | {
16 | /**
17 | * Unspecified. This value is never used.
18 | *
19 | * Generated from protobuf enum MORE_RESULTS_TYPE_UNSPECIFIED = 0;
20 | */
21 | const MORE_RESULTS_TYPE_UNSPECIFIED = 0;
22 | /**
23 | * There may be additional batches to fetch from this query.
24 | *
25 | * Generated from protobuf enum NOT_FINISHED = 1;
26 | */
27 | const NOT_FINISHED = 1;
28 | /**
29 | * The query is finished, but there may be more results after the limit.
30 | *
31 | * Generated from protobuf enum MORE_RESULTS_AFTER_LIMIT = 2;
32 | */
33 | const MORE_RESULTS_AFTER_LIMIT = 2;
34 | /**
35 | * The query is finished, but there may be more results after the end
36 | * cursor.
37 | *
38 | * Generated from protobuf enum MORE_RESULTS_AFTER_CURSOR = 4;
39 | */
40 | const MORE_RESULTS_AFTER_CURSOR = 4;
41 | /**
42 | * The query is finished, and there are no more results.
43 | *
44 | * Generated from protobuf enum NO_MORE_RESULTS = 3;
45 | */
46 | const NO_MORE_RESULTS = 3;
47 |
48 | private static $valueToName = [
49 | self::MORE_RESULTS_TYPE_UNSPECIFIED => 'MORE_RESULTS_TYPE_UNSPECIFIED',
50 | self::NOT_FINISHED => 'NOT_FINISHED',
51 | self::MORE_RESULTS_AFTER_LIMIT => 'MORE_RESULTS_AFTER_LIMIT',
52 | self::MORE_RESULTS_AFTER_CURSOR => 'MORE_RESULTS_AFTER_CURSOR',
53 | self::NO_MORE_RESULTS => 'NO_MORE_RESULTS',
54 | ];
55 |
56 | public static function name($value)
57 | {
58 | if (!isset(self::$valueToName[$value])) {
59 | throw new UnexpectedValueException(sprintf(
60 | 'Enum %s has no name defined for value %s', __CLASS__, $value));
61 | }
62 | return self::$valueToName[$value];
63 | }
64 |
65 |
66 | public static function value($name)
67 | {
68 | $const = __CLASS__ . '::' . strtoupper($name);
69 | if (!defined($const)) {
70 | throw new UnexpectedValueException(sprintf(
71 | 'Enum %s has no value defined for name %s', __CLASS__, $name));
72 | }
73 | return constant($const);
74 | }
75 | }
76 |
77 | // Adding a class alias for backwards compatibility with the previous class name.
78 | class_alias(MoreResultsType::class, \Google\Cloud\Datastore\V1\QueryResultBatch_MoreResultsType::class);
79 |
80 |
--------------------------------------------------------------------------------
/src/V1/QueryResultBatch_MoreResultsType.php:
--------------------------------------------------------------------------------
1 | new PartitionId([
18 | 'project_id' => $projectId
19 | ]),
20 | 'path' => [
21 | new PathElement([
22 | 'kind' => 'Company',
23 | 'name' => 'Google'
24 | ])
25 | ]
26 | ]);
27 |
28 | $entity = $datastoreClient->lookup($projectId, $keys);
29 | ```
30 |
--------------------------------------------------------------------------------
/src/V1/ReadOptions/ReadConsistency.php:
--------------------------------------------------------------------------------
1 | google.datastore.v1.ReadOptions.ReadConsistency
13 | */
14 | class ReadConsistency
15 | {
16 | /**
17 | * Unspecified. This value must not be used.
18 | *
19 | * Generated from protobuf enum READ_CONSISTENCY_UNSPECIFIED = 0;
20 | */
21 | const READ_CONSISTENCY_UNSPECIFIED = 0;
22 | /**
23 | * Strong consistency.
24 | *
25 | * Generated from protobuf enum STRONG = 1;
26 | */
27 | const STRONG = 1;
28 | /**
29 | * Eventual consistency.
30 | *
31 | * Generated from protobuf enum EVENTUAL = 2;
32 | */
33 | const EVENTUAL = 2;
34 |
35 | private static $valueToName = [
36 | self::READ_CONSISTENCY_UNSPECIFIED => 'READ_CONSISTENCY_UNSPECIFIED',
37 | self::STRONG => 'STRONG',
38 | self::EVENTUAL => 'EVENTUAL',
39 | ];
40 |
41 | public static function name($value)
42 | {
43 | if (!isset(self::$valueToName[$value])) {
44 | throw new UnexpectedValueException(sprintf(
45 | 'Enum %s has no name defined for value %s', __CLASS__, $value));
46 | }
47 | return self::$valueToName[$value];
48 | }
49 |
50 |
51 | public static function value($name)
52 | {
53 | $const = __CLASS__ . '::' . strtoupper($name);
54 | if (!defined($const)) {
55 | throw new UnexpectedValueException(sprintf(
56 | 'Enum %s has no value defined for name %s', __CLASS__, $name));
57 | }
58 | return constant($const);
59 | }
60 | }
61 |
62 | // Adding a class alias for backwards compatibility with the previous class name.
63 | class_alias(ReadConsistency::class, \Google\Cloud\Datastore\V1\ReadOptions_ReadConsistency::class);
64 |
65 |
--------------------------------------------------------------------------------
/src/V1/ReadOptions_ReadConsistency.php:
--------------------------------------------------------------------------------
1 | google.datastore.v1.ReserveIdsRequest
16 | */
17 | class ReserveIdsRequest extends \Google\Protobuf\Internal\Message
18 | {
19 | /**
20 | * Required. The ID of the project against which to make the request.
21 | *
22 | * Generated from protobuf field string project_id = 8 [(.google.api.field_behavior) = REQUIRED];
23 | */
24 | private $project_id = '';
25 | /**
26 | * The ID of the database against which to make the request.
27 | * '(default)' is not allowed; please use empty string '' to refer the default
28 | * database.
29 | *
30 | * Generated from protobuf field string database_id = 9;
31 | */
32 | private $database_id = '';
33 | /**
34 | * Required. A list of keys with complete key paths whose numeric IDs should
35 | * not be auto-allocated.
36 | *
37 | * Generated from protobuf field repeated .google.datastore.v1.Key keys = 1 [(.google.api.field_behavior) = REQUIRED];
38 | */
39 | private $keys;
40 |
41 | /**
42 | * @param string $projectId Required. The ID of the project against which to make the request.
43 | * @param \Google\Cloud\Datastore\V1\Key[] $keys Required. A list of keys with complete key paths whose numeric IDs should
44 | * not be auto-allocated.
45 | *
46 | * @return \Google\Cloud\Datastore\V1\ReserveIdsRequest
47 | *
48 | * @experimental
49 | */
50 | public static function build(string $projectId, array $keys): self
51 | {
52 | return (new self())
53 | ->setProjectId($projectId)
54 | ->setKeys($keys);
55 | }
56 |
57 | /**
58 | * Constructor.
59 | *
60 | * @param array $data {
61 | * Optional. Data for populating the Message object.
62 | *
63 | * @type string $project_id
64 | * Required. The ID of the project against which to make the request.
65 | * @type string $database_id
66 | * The ID of the database against which to make the request.
67 | * '(default)' is not allowed; please use empty string '' to refer the default
68 | * database.
69 | * @type array<\Google\Cloud\Datastore\V1\Key>|\Google\Protobuf\Internal\RepeatedField $keys
70 | * Required. A list of keys with complete key paths whose numeric IDs should
71 | * not be auto-allocated.
72 | * }
73 | */
74 | public function __construct($data = NULL) {
75 | \GPBMetadata\Google\Datastore\V1\Datastore::initOnce();
76 | parent::__construct($data);
77 | }
78 |
79 | /**
80 | * Required. The ID of the project against which to make the request.
81 | *
82 | * Generated from protobuf field string project_id = 8 [(.google.api.field_behavior) = REQUIRED];
83 | * @return string
84 | */
85 | public function getProjectId()
86 | {
87 | return $this->project_id;
88 | }
89 |
90 | /**
91 | * Required. The ID of the project against which to make the request.
92 | *
93 | * Generated from protobuf field string project_id = 8 [(.google.api.field_behavior) = REQUIRED];
94 | * @param string $var
95 | * @return $this
96 | */
97 | public function setProjectId($var)
98 | {
99 | GPBUtil::checkString($var, True);
100 | $this->project_id = $var;
101 |
102 | return $this;
103 | }
104 |
105 | /**
106 | * The ID of the database against which to make the request.
107 | * '(default)' is not allowed; please use empty string '' to refer the default
108 | * database.
109 | *
110 | * Generated from protobuf field string database_id = 9;
111 | * @return string
112 | */
113 | public function getDatabaseId()
114 | {
115 | return $this->database_id;
116 | }
117 |
118 | /**
119 | * The ID of the database against which to make the request.
120 | * '(default)' is not allowed; please use empty string '' to refer the default
121 | * database.
122 | *
123 | * Generated from protobuf field string database_id = 9;
124 | * @param string $var
125 | * @return $this
126 | */
127 | public function setDatabaseId($var)
128 | {
129 | GPBUtil::checkString($var, True);
130 | $this->database_id = $var;
131 |
132 | return $this;
133 | }
134 |
135 | /**
136 | * Required. A list of keys with complete key paths whose numeric IDs should
137 | * not be auto-allocated.
138 | *
139 | * Generated from protobuf field repeated .google.datastore.v1.Key keys = 1 [(.google.api.field_behavior) = REQUIRED];
140 | * @return \Google\Protobuf\Internal\RepeatedField
141 | */
142 | public function getKeys()
143 | {
144 | return $this->keys;
145 | }
146 |
147 | /**
148 | * Required. A list of keys with complete key paths whose numeric IDs should
149 | * not be auto-allocated.
150 | *
151 | * Generated from protobuf field repeated .google.datastore.v1.Key keys = 1 [(.google.api.field_behavior) = REQUIRED];
152 | * @param array<\Google\Cloud\Datastore\V1\Key>|\Google\Protobuf\Internal\RepeatedField $var
153 | * @return $this
154 | */
155 | public function setKeys($var)
156 | {
157 | $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Datastore\V1\Key::class);
158 | $this->keys = $arr;
159 |
160 | return $this;
161 | }
162 |
163 | }
164 |
165 |
--------------------------------------------------------------------------------
/src/V1/ReserveIdsResponse.php:
--------------------------------------------------------------------------------
1 | google.datastore.v1.ReserveIdsResponse
16 | */
17 | class ReserveIdsResponse extends \Google\Protobuf\Internal\Message
18 | {
19 |
20 | /**
21 | * Constructor.
22 | *
23 | * @param array $data {
24 | * Optional. Data for populating the Message object.
25 | *
26 | * }
27 | */
28 | public function __construct($data = NULL) {
29 | \GPBMetadata\Google\Datastore\V1\Datastore::initOnce();
30 | parent::__construct($data);
31 | }
32 |
33 | }
34 |
35 |
--------------------------------------------------------------------------------
/src/V1/ResultSetStats.php:
--------------------------------------------------------------------------------
1 | google.datastore.v1.ResultSetStats
15 | */
16 | class ResultSetStats extends \Google\Protobuf\Internal\Message
17 | {
18 | /**
19 | * Plan for the query.
20 | *
21 | * Generated from protobuf field .google.datastore.v1.QueryPlan query_plan = 1;
22 | */
23 | private $query_plan = null;
24 | /**
25 | * Aggregated statistics from the execution of the query.
26 | * This will only be present when the request specifies `PROFILE` mode.
27 | * For example, a query will return the statistics including:
28 | * {
29 | * "results_returned": "20",
30 | * "documents_scanned": "20",
31 | * "indexes_entries_scanned": "10050",
32 | * "total_execution_time": "100.7 msecs"
33 | * }
34 | *
35 | * Generated from protobuf field .google.protobuf.Struct query_stats = 2;
36 | */
37 | private $query_stats = null;
38 |
39 | /**
40 | * Constructor.
41 | *
42 | * @param array $data {
43 | * Optional. Data for populating the Message object.
44 | *
45 | * @type \Google\Cloud\Datastore\V1\QueryPlan $query_plan
46 | * Plan for the query.
47 | * @type \Google\Protobuf\Struct $query_stats
48 | * Aggregated statistics from the execution of the query.
49 | * This will only be present when the request specifies `PROFILE` mode.
50 | * For example, a query will return the statistics including:
51 | * {
52 | * "results_returned": "20",
53 | * "documents_scanned": "20",
54 | * "indexes_entries_scanned": "10050",
55 | * "total_execution_time": "100.7 msecs"
56 | * }
57 | * }
58 | */
59 | public function __construct($data = NULL) {
60 | \GPBMetadata\Google\Datastore\V1\QueryProfile::initOnce();
61 | parent::__construct($data);
62 | }
63 |
64 | /**
65 | * Plan for the query.
66 | *
67 | * Generated from protobuf field .google.datastore.v1.QueryPlan query_plan = 1;
68 | * @return \Google\Cloud\Datastore\V1\QueryPlan|null
69 | */
70 | public function getQueryPlan()
71 | {
72 | return $this->query_plan;
73 | }
74 |
75 | public function hasQueryPlan()
76 | {
77 | return isset($this->query_plan);
78 | }
79 |
80 | public function clearQueryPlan()
81 | {
82 | unset($this->query_plan);
83 | }
84 |
85 | /**
86 | * Plan for the query.
87 | *
88 | * Generated from protobuf field .google.datastore.v1.QueryPlan query_plan = 1;
89 | * @param \Google\Cloud\Datastore\V1\QueryPlan $var
90 | * @return $this
91 | */
92 | public function setQueryPlan($var)
93 | {
94 | GPBUtil::checkMessage($var, \Google\Cloud\Datastore\V1\QueryPlan::class);
95 | $this->query_plan = $var;
96 |
97 | return $this;
98 | }
99 |
100 | /**
101 | * Aggregated statistics from the execution of the query.
102 | * This will only be present when the request specifies `PROFILE` mode.
103 | * For example, a query will return the statistics including:
104 | * {
105 | * "results_returned": "20",
106 | * "documents_scanned": "20",
107 | * "indexes_entries_scanned": "10050",
108 | * "total_execution_time": "100.7 msecs"
109 | * }
110 | *
111 | * Generated from protobuf field .google.protobuf.Struct query_stats = 2;
112 | * @return \Google\Protobuf\Struct|null
113 | */
114 | public function getQueryStats()
115 | {
116 | return $this->query_stats;
117 | }
118 |
119 | public function hasQueryStats()
120 | {
121 | return isset($this->query_stats);
122 | }
123 |
124 | public function clearQueryStats()
125 | {
126 | unset($this->query_stats);
127 | }
128 |
129 | /**
130 | * Aggregated statistics from the execution of the query.
131 | * This will only be present when the request specifies `PROFILE` mode.
132 | * For example, a query will return the statistics including:
133 | * {
134 | * "results_returned": "20",
135 | * "documents_scanned": "20",
136 | * "indexes_entries_scanned": "10050",
137 | * "total_execution_time": "100.7 msecs"
138 | * }
139 | *
140 | * Generated from protobuf field .google.protobuf.Struct query_stats = 2;
141 | * @param \Google\Protobuf\Struct $var
142 | * @return $this
143 | */
144 | public function setQueryStats($var)
145 | {
146 | GPBUtil::checkMessage($var, \Google\Protobuf\Struct::class);
147 | $this->query_stats = $var;
148 |
149 | return $this;
150 | }
151 |
152 | }
153 |
154 |
--------------------------------------------------------------------------------
/src/V1/RollbackRequest.php:
--------------------------------------------------------------------------------
1 | google.datastore.v1.RollbackRequest
15 | */
16 | class RollbackRequest extends \Google\Protobuf\Internal\Message
17 | {
18 | /**
19 | * Required. The ID of the project against which to make the request.
20 | *
21 | * Generated from protobuf field string project_id = 8 [(.google.api.field_behavior) = REQUIRED];
22 | */
23 | private $project_id = '';
24 | /**
25 | * The ID of the database against which to make the request.
26 | * '(default)' is not allowed; please use empty string '' to refer the default
27 | * database.
28 | *
29 | * Generated from protobuf field string database_id = 9;
30 | */
31 | private $database_id = '';
32 | /**
33 | * Required. The transaction identifier, returned by a call to
34 | * [Datastore.BeginTransaction][google.datastore.v1.Datastore.BeginTransaction].
35 | *
36 | * Generated from protobuf field bytes transaction = 1 [(.google.api.field_behavior) = REQUIRED];
37 | */
38 | private $transaction = '';
39 |
40 | /**
41 | * @param string $projectId Required. The ID of the project against which to make the request.
42 | * @param string $transaction Required. The transaction identifier, returned by a call to
43 | * [Datastore.BeginTransaction][google.datastore.v1.Datastore.BeginTransaction].
44 | *
45 | * @return \Google\Cloud\Datastore\V1\RollbackRequest
46 | *
47 | * @experimental
48 | */
49 | public static function build(string $projectId, string $transaction): self
50 | {
51 | return (new self())
52 | ->setProjectId($projectId)
53 | ->setTransaction($transaction);
54 | }
55 |
56 | /**
57 | * Constructor.
58 | *
59 | * @param array $data {
60 | * Optional. Data for populating the Message object.
61 | *
62 | * @type string $project_id
63 | * Required. The ID of the project against which to make the request.
64 | * @type string $database_id
65 | * The ID of the database against which to make the request.
66 | * '(default)' is not allowed; please use empty string '' to refer the default
67 | * database.
68 | * @type string $transaction
69 | * Required. The transaction identifier, returned by a call to
70 | * [Datastore.BeginTransaction][google.datastore.v1.Datastore.BeginTransaction].
71 | * }
72 | */
73 | public function __construct($data = NULL) {
74 | \GPBMetadata\Google\Datastore\V1\Datastore::initOnce();
75 | parent::__construct($data);
76 | }
77 |
78 | /**
79 | * Required. The ID of the project against which to make the request.
80 | *
81 | * Generated from protobuf field string project_id = 8 [(.google.api.field_behavior) = REQUIRED];
82 | * @return string
83 | */
84 | public function getProjectId()
85 | {
86 | return $this->project_id;
87 | }
88 |
89 | /**
90 | * Required. The ID of the project against which to make the request.
91 | *
92 | * Generated from protobuf field string project_id = 8 [(.google.api.field_behavior) = REQUIRED];
93 | * @param string $var
94 | * @return $this
95 | */
96 | public function setProjectId($var)
97 | {
98 | GPBUtil::checkString($var, True);
99 | $this->project_id = $var;
100 |
101 | return $this;
102 | }
103 |
104 | /**
105 | * The ID of the database against which to make the request.
106 | * '(default)' is not allowed; please use empty string '' to refer the default
107 | * database.
108 | *
109 | * Generated from protobuf field string database_id = 9;
110 | * @return string
111 | */
112 | public function getDatabaseId()
113 | {
114 | return $this->database_id;
115 | }
116 |
117 | /**
118 | * The ID of the database against which to make the request.
119 | * '(default)' is not allowed; please use empty string '' to refer the default
120 | * database.
121 | *
122 | * Generated from protobuf field string database_id = 9;
123 | * @param string $var
124 | * @return $this
125 | */
126 | public function setDatabaseId($var)
127 | {
128 | GPBUtil::checkString($var, True);
129 | $this->database_id = $var;
130 |
131 | return $this;
132 | }
133 |
134 | /**
135 | * Required. The transaction identifier, returned by a call to
136 | * [Datastore.BeginTransaction][google.datastore.v1.Datastore.BeginTransaction].
137 | *
138 | * Generated from protobuf field bytes transaction = 1 [(.google.api.field_behavior) = REQUIRED];
139 | * @return string
140 | */
141 | public function getTransaction()
142 | {
143 | return $this->transaction;
144 | }
145 |
146 | /**
147 | * Required. The transaction identifier, returned by a call to
148 | * [Datastore.BeginTransaction][google.datastore.v1.Datastore.BeginTransaction].
149 | *
150 | * Generated from protobuf field bytes transaction = 1 [(.google.api.field_behavior) = REQUIRED];
151 | * @param string $var
152 | * @return $this
153 | */
154 | public function setTransaction($var)
155 | {
156 | GPBUtil::checkString($var, False);
157 | $this->transaction = $var;
158 |
159 | return $this;
160 | }
161 |
162 | }
163 |
164 |
--------------------------------------------------------------------------------
/src/V1/RollbackResponse.php:
--------------------------------------------------------------------------------
1 | google.datastore.v1.RollbackResponse
17 | */
18 | class RollbackResponse extends \Google\Protobuf\Internal\Message
19 | {
20 |
21 | /**
22 | * Constructor.
23 | *
24 | * @param array $data {
25 | * Optional. Data for populating the Message object.
26 | *
27 | * }
28 | */
29 | public function __construct($data = NULL) {
30 | \GPBMetadata\Google\Datastore\V1\Datastore::initOnce();
31 | parent::__construct($data);
32 | }
33 |
34 | }
35 |
36 |
--------------------------------------------------------------------------------
/src/V1/TransactionOptions.php:
--------------------------------------------------------------------------------
1 | google.datastore.v1.TransactionOptions
20 | */
21 | class TransactionOptions extends \Google\Protobuf\Internal\Message
22 | {
23 | protected $mode;
24 |
25 | /**
26 | * Constructor.
27 | *
28 | * @param array $data {
29 | * Optional. Data for populating the Message object.
30 | *
31 | * @type \Google\Cloud\Datastore\V1\TransactionOptions\ReadWrite $read_write
32 | * The transaction should allow both reads and writes.
33 | * @type \Google\Cloud\Datastore\V1\TransactionOptions\PBReadOnly $read_only
34 | * The transaction should only allow reads.
35 | * }
36 | */
37 | public function __construct($data = NULL) {
38 | \GPBMetadata\Google\Datastore\V1\Datastore::initOnce();
39 | parent::__construct($data);
40 | }
41 |
42 | /**
43 | * The transaction should allow both reads and writes.
44 | *
45 | * Generated from protobuf field .google.datastore.v1.TransactionOptions.ReadWrite read_write = 1;
46 | * @return \Google\Cloud\Datastore\V1\TransactionOptions\ReadWrite|null
47 | */
48 | public function getReadWrite()
49 | {
50 | return $this->readOneof(1);
51 | }
52 |
53 | public function hasReadWrite()
54 | {
55 | return $this->hasOneof(1);
56 | }
57 |
58 | /**
59 | * The transaction should allow both reads and writes.
60 | *
61 | * Generated from protobuf field .google.datastore.v1.TransactionOptions.ReadWrite read_write = 1;
62 | * @param \Google\Cloud\Datastore\V1\TransactionOptions\ReadWrite $var
63 | * @return $this
64 | */
65 | public function setReadWrite($var)
66 | {
67 | GPBUtil::checkMessage($var, \Google\Cloud\Datastore\V1\TransactionOptions\ReadWrite::class);
68 | $this->writeOneof(1, $var);
69 |
70 | return $this;
71 | }
72 |
73 | /**
74 | * The transaction should only allow reads.
75 | *
76 | * Generated from protobuf field .google.datastore.v1.TransactionOptions.ReadOnly read_only = 2;
77 | * @return \Google\Cloud\Datastore\V1\TransactionOptions\PBReadOnly|null
78 | */
79 | public function getReadOnly()
80 | {
81 | return $this->readOneof(2);
82 | }
83 |
84 | public function hasReadOnly()
85 | {
86 | return $this->hasOneof(2);
87 | }
88 |
89 | /**
90 | * The transaction should only allow reads.
91 | *
92 | * Generated from protobuf field .google.datastore.v1.TransactionOptions.ReadOnly read_only = 2;
93 | * @param \Google\Cloud\Datastore\V1\TransactionOptions\PBReadOnly $var
94 | * @return $this
95 | */
96 | public function setReadOnly($var)
97 | {
98 | GPBUtil::checkMessage($var, \Google\Cloud\Datastore\V1\TransactionOptions\PBReadOnly::class);
99 | $this->writeOneof(2, $var);
100 |
101 | return $this;
102 | }
103 |
104 | /**
105 | * @return string
106 | */
107 | public function getMode()
108 | {
109 | return $this->whichOneof("mode");
110 | }
111 |
112 | }
113 |
114 |
--------------------------------------------------------------------------------
/src/V1/TransactionOptions/PBReadOnly.php:
--------------------------------------------------------------------------------
1 | google.datastore.v1.TransactionOptions.ReadOnly
15 | */
16 | class PBReadOnly extends \Google\Protobuf\Internal\Message
17 | {
18 | /**
19 | * Reads entities at the given time.
20 | * This must be a microsecond precision timestamp within the past one hour,
21 | * or if Point-in-Time Recovery is enabled, can additionally be a whole
22 | * minute timestamp within the past 7 days.
23 | *
24 | * Generated from protobuf field .google.protobuf.Timestamp read_time = 1;
25 | */
26 | private $read_time = null;
27 |
28 | /**
29 | * Constructor.
30 | *
31 | * @param array $data {
32 | * Optional. Data for populating the Message object.
33 | *
34 | * @type \Google\Protobuf\Timestamp $read_time
35 | * Reads entities at the given time.
36 | * This must be a microsecond precision timestamp within the past one hour,
37 | * or if Point-in-Time Recovery is enabled, can additionally be a whole
38 | * minute timestamp within the past 7 days.
39 | * }
40 | */
41 | public function __construct($data = NULL) {
42 | \GPBMetadata\Google\Datastore\V1\Datastore::initOnce();
43 | parent::__construct($data);
44 | }
45 |
46 | /**
47 | * Reads entities at the given time.
48 | * This must be a microsecond precision timestamp within the past one hour,
49 | * or if Point-in-Time Recovery is enabled, can additionally be a whole
50 | * minute timestamp within the past 7 days.
51 | *
52 | * Generated from protobuf field .google.protobuf.Timestamp read_time = 1;
53 | * @return \Google\Protobuf\Timestamp|null
54 | */
55 | public function getReadTime()
56 | {
57 | return $this->read_time;
58 | }
59 |
60 | public function hasReadTime()
61 | {
62 | return isset($this->read_time);
63 | }
64 |
65 | public function clearReadTime()
66 | {
67 | unset($this->read_time);
68 | }
69 |
70 | /**
71 | * Reads entities at the given time.
72 | * This must be a microsecond precision timestamp within the past one hour,
73 | * or if Point-in-Time Recovery is enabled, can additionally be a whole
74 | * minute timestamp within the past 7 days.
75 | *
76 | * Generated from protobuf field .google.protobuf.Timestamp read_time = 1;
77 | * @param \Google\Protobuf\Timestamp $var
78 | * @return $this
79 | */
80 | public function setReadTime($var)
81 | {
82 | GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class);
83 | $this->read_time = $var;
84 |
85 | return $this;
86 | }
87 |
88 | }
89 |
90 | // Adding a class alias for backwards compatibility with the previous class name.
91 | class_alias(PBReadOnly::class, \Google\Cloud\Datastore\V1\TransactionOptions_ReadOnly::class);
92 |
93 |
94 |
--------------------------------------------------------------------------------
/src/V1/TransactionOptions/ReadOnly.php:
--------------------------------------------------------------------------------
1 | google.datastore.v1.TransactionOptions.ReadWrite
15 | */
16 | class ReadWrite extends \Google\Protobuf\Internal\Message
17 | {
18 | /**
19 | * The transaction identifier of the transaction being retried.
20 | *
21 | * Generated from protobuf field bytes previous_transaction = 1;
22 | */
23 | private $previous_transaction = '';
24 |
25 | /**
26 | * Constructor.
27 | *
28 | * @param array $data {
29 | * Optional. Data for populating the Message object.
30 | *
31 | * @type string $previous_transaction
32 | * The transaction identifier of the transaction being retried.
33 | * }
34 | */
35 | public function __construct($data = NULL) {
36 | \GPBMetadata\Google\Datastore\V1\Datastore::initOnce();
37 | parent::__construct($data);
38 | }
39 |
40 | /**
41 | * The transaction identifier of the transaction being retried.
42 | *
43 | * Generated from protobuf field bytes previous_transaction = 1;
44 | * @return string
45 | */
46 | public function getPreviousTransaction()
47 | {
48 | return $this->previous_transaction;
49 | }
50 |
51 | /**
52 | * The transaction identifier of the transaction being retried.
53 | *
54 | * Generated from protobuf field bytes previous_transaction = 1;
55 | * @param string $var
56 | * @return $this
57 | */
58 | public function setPreviousTransaction($var)
59 | {
60 | GPBUtil::checkString($var, False);
61 | $this->previous_transaction = $var;
62 |
63 | return $this;
64 | }
65 |
66 | }
67 |
68 | // Adding a class alias for backwards compatibility with the previous class name.
69 | class_alias(ReadWrite::class, \Google\Cloud\Datastore\V1\TransactionOptions_ReadWrite::class);
70 |
71 |
--------------------------------------------------------------------------------
/src/V1/TransactionOptions_ReadOnly.php:
--------------------------------------------------------------------------------
1 |