Google.Cloud.Spanner.Data - Class ReadOptions (5.4.0)

public sealed class ReadOptions

Reference documentation and code samples for the Google.Cloud.Spanner.Data class ReadOptions.

ReadOptions define a read operation for a Spanner table.

Inheritance

object > ReadOptions

Namespace

Google.Cloud.Spanner.Data

Assembly

Google.Cloud.Spanner.Data.dll

Properties

Columns

public IReadOnlyList<string> Columns { get; }

Returns the columns that will be read from the target table. Cannot be null or empty.

Property Value
Type Description
IReadOnlyListstring

IndexName

public string IndexName { get; }

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.

Property Value
Type Description
string

Limit

public long? Limit { get; }

The maximum number of rows to read from the target table, or null if there is no limit.

Property Value
Type Description
long

LockHint

public LockHint? LockHint { get; }

A lock hint for reads within a transaction. May be null, in which case appropriate defaults will be used. See LockHint for details.

Property Value
Type Description
LockHint

OrderBy

public OrderBy? OrderBy { get; }

The order in which rows are returned from a read. May be null, in which case appropriate defaults will be used. See OrderBy for details.

Property Value
Type Description
OrderBy

Methods

FromColumns(IEnumerable<string>)

public static ReadOptions FromColumns(IEnumerable<string> columns)

Creates options to read the given columns using a ReadCommand.

Parameter
Name Description
columns IEnumerablestring

The columns to read from the target table. Must not be null or empty.

Returns
Type Description
ReadOptions

FromColumns(params string[])

public static ReadOptions FromColumns(params string[] columns)

Creates options to read the given columns using a ReadCommand.

Parameter
Name Description
columns string

The columns to read from the target table. Must not be null or empty.

Returns
Type Description
ReadOptions

WithIndexName(string)

public ReadOptions WithIndexName(string indexName)

Returns a clone of this ReadOptions with the given index name.

Parameter
Name Description
indexName string

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?)

public ReadOptions WithLimit(long? limit)

Creates a clone of this ReadOptions with the given limit.

Parameter
Name Description
limit long

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.

WithLockHint(LockHint?)

public ReadOptions WithLockHint(LockHint? lockHint)

Returns a clone of this ReadOptions with the given lock hint.

Parameter
Name Description
lockHint LockHint

The value to use for the lockHint mechanism for the ReadOptions. The new lock hint value. May be null in which case appropriate defaults will be used. See LockHint for available options.

Returns
Type Description
ReadOptions

A clone of this ReadOptions with the given lock hint.

WithOrderBy(OrderBy?)

public ReadOptions WithOrderBy(OrderBy? orderBy)

Returns a clone of this ReadOptions with the given order by value.

Parameter
Name Description
orderBy OrderBy

The order on which rows are returned from a read. May be null, in which case appropriate defaults will be used. Only read-write transactions accept non-null values. See OrderBy for available options.

Returns
Type Description
ReadOptions

A clone of this ReadOptions with the given ReadOptions value.