- 1.104.0 (latest)
- 1.103.0
- 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]
]);
Methods
__construct
Create a KeyRange.
options
array
Configuration Options.
↳ startType
string
Either "open" or "closed". Use constants KeyRange::TYPE_OPEN
and KeyRange::TYPE_CLOSED
for guaranteed correctness. Defaults to KeyRange::TYPE_OPEN
.
↳ start
array
The key with which to start the range.
↳ endType
string
Either "open" or "closed". Use constants KeyRange::TYPE_OPEN
and KeyRange::TYPE_CLOSED
for guaranteed correctness. Defaults to KeyRange::TYPE_OPEN
.
↳ end
array
The key with which to end the range.
start
Get the range start.
Example:
$start = $range->start();
array|null
setStart
Set the range start.
Example:
$range->setStart(KeyRange::TYPE_OPEN, ['Bob']);
type
string
Either "open" or "closed". Use constants KeyRange::TYPE_OPEN
and KeyRange::TYPE_CLOSED
for guaranteed
correctness.
start
array
The start of the key range.
void
end
Get the range end.
Example:
$end = $range->end();
array
setEnd
Set the range end.
Example:
$range->setEnd(KeyRange::TYPE_CLOSED, ['Jill']);
type
string
Either "open" or "closed". Use constants KeyRange::TYPE_OPEN
and KeyRange::TYPE_CLOSED
for guaranteed
correctness.
end
array
The end of the key range.
void
types
Get the start and end types
Example:
$types = $range->types();
array
keyRangeObject
Returns an API-compliant representation of a KeyRange.
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);
key
array
The key to match against.
static::fromArray
Create a KeyRange from an array created by Google\Cloud\Spanner\KeyRange::keyRangeObject() .
range
array
An array of KeyRange data.
Constants
TYPE_OPEN
Value: 'open'
TYPE_CLOSED
Value: 'closed'