Class ReadOptions
ReadOptions define a read operation for a Spanner table.
Namespace: Google.Cloud.Spanner.Data
Assembly: Google.Cloud.Spanner.Data.dll
Syntax
public sealed class ReadOptions
Properties
Columns
Returns the columns that will be read from the target table. Cannot be null or empty.
Declaration
public IReadOnlyList<string> Columns { get; }
Property Value
Type | Description |
---|---|
IReadOnlyList<string> |
IndexName
The index to use to search and order rows from the target table if the read operation should use a different index than the primary key, or null otherwise. The rows will be returned in the order of the specified index.
Declaration
public string IndexName { get; }
Property Value
Type | Description |
---|---|
string |
Limit
The maximum number of rows to read from the target table, or null if there is no limit.
Declaration
public long? Limit { get; }
Property Value
Type | Description |
---|---|
long? |
Methods
FromColumns(IEnumerable<string>)
Creates options to read the given columns using a ReadCommand.
Declaration
public static ReadOptions FromColumns(IEnumerable<string> columns)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<string> | columns | The columns to read from the target table. Must not be null or empty. |
Returns
Type | Description |
---|---|
ReadOptions |
FromColumns(params string[])
Creates options to read the given columns using a ReadCommand.
Declaration
public static ReadOptions FromColumns(params string[] columns)
Parameters
Type | Name | Description |
---|---|---|
string[] | columns | The columns to read from the target table. Must not be null or empty. |
Returns
Type | Description |
---|---|
ReadOptions |
WithIndexName(string)
Returns a clone of this ReadOptions with the given index name.
Declaration
public ReadOptions WithIndexName(string indexName)
Parameters
Type | Name | Description |
---|---|---|
string | indexName | The index to use to search and order rows from the target table if the read operation should use a different index than the primary key. The rows will be returned in the order of the specified index. May not an empty string. Null means that the primary key of the table should be used for the read operation. |
Returns
Type | Description |
---|---|
ReadOptions | A clone of this ReadOptions with the given index name. |
WithLimit(long?)
Creates a clone of this ReadOptions with the given limit.
Declaration
public ReadOptions WithLimit(long? limit)
Parameters
Type | Name | Description |
---|---|---|
long? | limit | The maximum number of rows to read. Must be larger than 0. Null means no limit. |
Returns
Type | Description |
---|---|
ReadOptions | A clone of this ReadOptions with the given limit. |