- 1.103.0 (latest)
- 1.102.0
- 1.101.0
- 1.100.0
- 1.98.0
- 1.97.0
- 1.96.0
- 1.95.0
- 1.94.0
- 1.93.1
- 1.92.1
- 1.91.0
- 1.90.0
- 1.89.0
- 1.88.0
- 1.87.0
- 1.86.0
- 1.85.0
- 1.84.0
- 1.83.0
- 1.82.0
- 1.81.0
- 1.80.0
- 1.79.0
- 1.78.0
- 1.77.0
- 1.76.1
- 1.68.0
- 1.67.0
- 1.66.0
- 1.65.0
- 1.64.0
- 1.63.2
- 1.62.1
- 1.61.0
- 1.60.0
- 1.59.0
- 1.58.4
- 1.57.0
- 1.56.0
- 1.55.0
- 1.54.2
Reference documentation and code samples for the Cloud Spanner Client class KeyRange.
Represents a Cloud Spanner KeyRange.
Example:
use Google\Cloud\Spanner\SpannerClient;
$spanner = new SpannerClient();
// Create a KeyRange for all people named Bob, born in 1969.
$start = $spanner->date(new \DateTime('1969-01-01'));
$end = $spanner->date(new \DateTime('1969-12-31'));
$range = $spanner->keyRange([
'startType' => KeyRange::TYPE_CLOSED,
'start' => ['Bob', $start],
'endType' => KeyRange::TYPE_CLOSED,
'end' => ['Bob', $end]
]);
Namespace
Google \ Cloud \ SpannerMethods
__construct
Create a KeyRange.
Parameters | |
---|---|
Name | Description |
options |
array
Configuration Options. |
↳ startType |
string
Either "open" or "closed". Use constants |
↳ start |
array
The key with which to start the range. |
↳ endType |
string
Either "open" or "closed". Use constants |
↳ end |
array
The key with which to end the range. |
start
Get the range start.
Example:
$start = $range->start();
Returns | |
---|---|
Type | Description |
array|null |
setStart
Set the range start.
Example:
$range->setStart(KeyRange::TYPE_OPEN, ['Bob']);
Parameters | |
---|---|
Name | Description |
type |
string
Either "open" or "closed". Use constants
|
start |
array
The start of the key range. |
Returns | |
---|---|
Type | Description |
void |
end
Get the range end.
Example:
$end = $range->end();
Returns | |
---|---|
Type | Description |
array |
setEnd
Set the range end.
Example:
$range->setEnd(KeyRange::TYPE_CLOSED, ['Jill']);
Parameters | |
---|---|
Name | Description |
type |
string
Either "open" or "closed". Use constants
|
end |
array
The end of the key range. |
Returns | |
---|---|
Type | Description |
void |
types
Get the start and end types
Example:
$types = $range->types();
Returns | |
---|---|
Type | Description |
array |
An array containing `start` and `end` keys. |
keyRangeObject
Returns an API-compliant representation of a KeyRange.
Returns | |
---|---|
Type | Description |
array |
static::prefixMatch
Returns a key range that covers all keys where the first components match.
Equivalent to calling KeyRange::__construct()
with closed type for start
and end, and the same key for the start and end.
Example:
$range = KeyRange::prefixMatch($key);
Parameter | |
---|---|
Name | Description |
key |
array
The key to match against. |
Returns | |
---|---|
Type | Description |
KeyRange |
static::fromArray
Create a KeyRange from an array created by KeyRange::keyRangeObject().
Parameter | |
---|---|
Name | Description |
range |
array
An array of KeyRange data. |
Returns | |
---|---|
Type | Description |
KeyRange |
Constants
TYPE_OPEN
Value: 'open'
TYPE_CLOSED
Value: 'closed'