-
Notifications
You must be signed in to change notification settings - Fork 438
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update Bigtable branch with latest from master (#1190)
* Add isRacy() to SafeSearch (#1166) The SafeSearch class included `is` functions for each SafeSearch feature (adult, spoof, medical, violence), but was missing Racy. This Pull Request adds `isRacy()` to the SafeSearch class. * Exclude component vendor folder from snippet coverage (#1168) cc @tmatsuo * Allow context to handle Throwable interface (#1164) * Add getServiceAccount to the BigQueryClient (#1167) * Add getServiceAccount to the BigQueryClient See: https://cloud.google.com/bigquery/docs/reference/rest/v2/projects/getServiceAccount * Added $options to getServiceAccount and fixed the indent * Use single quote * Add snippet test * Comment update, use self instead of $this * Comment update * Prepare v0.71.0 (#1169) * Prepare v0.71.0 * patch release for Logging * Correct version for Logging * [Kms] Regenerate with the new gapic config (#1165) * Update for the new gapic configuration * Docs update for the new and nicer namespace * Removed the files with the old namespace * Use the new namespace in the code sample Add back the deprecated files * Changed the wording for the deprecation warning * Fix firestore queries (#1161) * Bump gax to 0.35 (#1170) * Add an interactive release builder. (#1160) * Add an interactive release builder. * Create build directory if it doesn't exist * Add getServiceAccount method to StorageClient (#1173) * Re-generate library using Tasks/synth.py (#1174) * Re-generate library using Tasks/synth.py * Use new namespace in user visible area, tweak the deprecation wording * Add support for Numeric type (#1172) * Add support for Numeric type * Added a cast in Numeric's constructor, added system tests * Allow '123.' and '.123', update tests * [Breaking Change] Add support for Document Snapshots in Firestore Query Cursors (#1162) cc @schmidt-sebastian Extracted from #923 and updated to address pull request comments. Breaking change is the standardization in Query of using `InvalidArgumentException`, replacing various throws of `BadMethodCallException`. Closes #851. * Fix Storage Requesterpays system tests (#1180) The requester pays system tests have been broken for some time. This change fixes them. * Bandaid for protobuf 4761 (#1176) * Temporary workaround for protobuf extension issue protocolbuffers/protobuf#4761 * Bump gax to 0.36 * Configure comparators for the unit test * Revert back to normal TestCase * Install protobuf extension in the PHP 7.2 test runner * Revert to TestCase * Prepare v0.72.0 (#1181) * Added a document for the time filter on BigQueryClient->jobs() (#1183) * Narrowed the time filter in the system test (#1185) * Re-generate library using BigQueryDataTransfer/synth.py (#1184) * Re-generate library using BigQueryDataTransfer/synth.py * Tweak the wording on the deprecation warning Also use the new namespace in the sample code * pin auth version until we have a way to silence warnings (#1189)
- Loading branch information
Showing
232 changed files
with
5,540 additions
and
1,370 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
1.2.4 | ||
1.4.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
<?php | ||
/** | ||
* Copyright 2018 Google LLC | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
namespace Google\Cloud\BigQuery; | ||
|
||
/** | ||
* Represents a value with a data type of | ||
* [Numeric](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-types#numeric-type). | ||
* | ||
* It supports a fixed 38 decimal digits of precision and 9 decimal digits of scale, and values | ||
* are in the range of -99999999999999999999999999999.999999999 to | ||
* 99999999999999999999999999999.999999999. | ||
* | ||
* Example: | ||
* ``` | ||
* use Google\Cloud\BigQuery\BigQueryClient; | ||
* | ||
* $bigQuery = new BigQueryClient(); | ||
* | ||
* $numeric = $bigQuery->numeric('99999999999999999999999999999999999999.999999999'); | ||
* ``` | ||
*/ | ||
class Numeric implements ValueInterface | ||
{ | ||
/** | ||
* @var string | ||
*/ | ||
private $value; | ||
|
||
/** | ||
* @param string|int|float $value The NUMERIC value. | ||
* @throws \InvalidArgumentException | ||
*/ | ||
public function __construct($value) | ||
{ | ||
$value = (string) $value; | ||
// allow minus sign at the beginning | ||
// 38 or less decimal digits (or none) | ||
// optional period and 9 or less digits of scale | ||
$pattern = '/^-?([0-9]{1,38})?(\.([0-9]{1,9})?)?$/'; | ||
if (! preg_match($pattern, $value)) { | ||
throw new \InvalidArgumentException( | ||
'Numeric type only allows fixed 38 decimal digits and 9 decimal digits of scale.' | ||
); | ||
} | ||
$this->value = $value; | ||
} | ||
|
||
/** | ||
* Get the underlying value. | ||
* | ||
* @return string | ||
*/ | ||
public function get() | ||
{ | ||
return $this->value; | ||
} | ||
|
||
/** | ||
* Get the type. | ||
* | ||
* @return string | ||
*/ | ||
public function type() | ||
{ | ||
return ValueMapper::TYPE_NUMERIC; | ||
} | ||
|
||
/** | ||
* Format the value as a string. | ||
* | ||
* @return string | ||
*/ | ||
public function formatAsString() | ||
{ | ||
return $this->value; | ||
} | ||
|
||
/** | ||
* Format the value as a string. | ||
* | ||
* @return string | ||
*/ | ||
public function __toString() | ||
{ | ||
return $this->value; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
/** | ||
* Copyright 2018 Google LLC | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
namespace Google\Cloud\BigQuery\Tests\Snippet; | ||
|
||
use Google\Cloud\BigQuery\Numeric; | ||
use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; | ||
|
||
/** | ||
* @group bigquery | ||
*/ | ||
class NumericTest extends SnippetTestCase | ||
{ | ||
public function testClass() | ||
{ | ||
$expected = new Numeric('99999999999999999999999999999999999999.999999999'); | ||
$snippet = $this->snippetFromClass(Numeric::class); | ||
$res = $snippet->invoke('numeric'); | ||
|
||
$this->assertInstanceOf(Numeric::class, $res->returnVal()); | ||
$this->assertEquals($expected, $res->returnVal()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.