public sealed class KeySetImmutable class that defines a set of keys to select from a table or index. KeySets are used for Read operations to specify the rows that should be returned by the read. A KeySet can be created from a set of individual keys or a set of key ranges. The All instance can be used for read operations that should return all rows.
Namespace
Google.Cloud.Spanner.DataAssembly
Google.Cloud.Spanner.Data.dll
Example
Example usage:
using var cmd = connection.CreateReadCommand(
"MyTable",
ReadOptions.FromColumns("MyCol1", "MyCol2"),
KeySet.FromKeys(new Key("k1"), new Key("k2")));
using var reader = await cmd.ExecuteReaderAsync();Properties
All
public static KeySet All { get; }Returns a key set that selects all keys in the table or index.
| Property Value | |
|---|---|
| Type | Description |
KeySet |
|
AllKeys
public bool AllKeys { get; }True for key sets that select all keys in the table or index, and false for all other key sets.
| Property Value | |
|---|---|
| Type | Description |
Boolean |
|
Keys
public IEnumerable<Key> Keys { get; }The collection of specific keys to select.
| Property Value | |
|---|---|
| Type | Description |
IEnumerable<Key> |
|
Ranges
public IEnumerable<KeyRange> Ranges { get; }The list of key ranges to select. All rows that are in at least one of the key ranges will be selected.
| Property Value | |
|---|---|
| Type | Description |
IEnumerable<KeyRange> |
|
Methods
FromKeys(Key[])
public static KeySet FromKeys(params Key[] keys)Creates a new key set for a collection of keys.
| Parameter | |
|---|---|
| Name | Description |
keys |
Key[]The keys to select |
| Returns | |
|---|---|
| Type | Description |
KeySet |
A key set for a collection of keys |
FromParameters(SpannerParameterCollection)
public static KeySet FromParameters(SpannerParameterCollection parameters)Creates a new key set from a collection of parameters that represent exactly one key.
| Parameter | |
|---|---|
| Name | Description |
parameters |
SpannerParameterCollectionA parameter collection containing the values of the key |
| Returns | |
|---|---|
| Type | Description |
KeySet |
A key set for one specific key |
FromRanges(KeyRange[])
public static KeySet FromRanges(params KeyRange[] ranges)Creates a new key set for a collection of key ranges.
| Parameter | |
|---|---|
| Name | Description |
ranges |
KeyRange[]The key ranges to select |
| Returns | |
|---|---|
| Type | Description |
KeySet |
A key set for a collection of key ranges |
GetHashCode()
public override int GetHashCode()| Returns | |
|---|---|
| Type | Description |
Int32 |
|
ToString()
public override string ToString()| Returns | |
|---|---|
| Type | Description |
String |
|