Class SpannerStruct (3.15.1)

public sealed class SpannerStruct : IReadOnlyList<SpannerStruct.Field>, IReadOnlyCollection<SpannerStruct.Field>, IEnumerable<SpannerStruct.Field>, IEnumerable

A struct parameter or returned value.

Inheritance

Object > SpannerStruct

Namespace

Google.Cloud.Spanner.Data

Assembly

Google.Cloud.Spanner.Data.dll

Remarks

A Spanner struct isn't exactly the same as a Google Protobuf struct:

  • Field names are optional
  • Field names do not have to be unique

Properties

Count

public int Count { get; }

Returns the number of fields currently in the struct.

Property Value
TypeDescription
Int32

Item[Int32]

public SpannerStruct.Field this[int index] { get; }

Returns the field at the given index.

Parameter
NameDescription
indexInt32

The index of the field to return

Property Value
TypeDescription
SpannerStruct.Field

The field at the given index

Methods

Add(SpannerStruct.Field)

public SpannerStruct.Field Add(SpannerStruct.Field field)

Adds a new field to the struct.

Parameter
NameDescription
fieldSpannerStruct.Field

The field to add. Must not be null.

Returns
TypeDescription
SpannerStruct.Field

field for convenience

Add(String, SpannerDbType, Object)

public SpannerStruct.Field Add(string name, SpannerDbType type, object value)

Adds a new field to the struct with the given name, type and value.

Parameters
NameDescription
nameString

The name of the field. May be null, and does not need to be unique within the struct. If the value is null, the SpannerStruct.Field value added will have an empty string for the name.

typeSpannerDbType

The type of the field. Must not be null.

valueObject

The value of the field. May be null.

Returns
TypeDescription
SpannerStruct.Field

The newly-added field.

GetEnumerator()

public IEnumerator<SpannerStruct.Field> GetEnumerator()
Returns
TypeDescription
IEnumerator<SpannerStruct.Field>

GetSpannerDbType()

public SpannerDbType GetSpannerDbType()

Returns the full schema of this struct as a SpannerDbType.

Returns
TypeDescription
SpannerDbType

The SpannerDbType representing the schema of this struct.

Remarks

The returned object reflects the current fields in the struct. If more fields are added later, those changes will not be visible via the returned value. Instead, this method should be called again obtain the up-to-date schema.

Explicit Interface Implementations

IEnumerable.GetEnumerator()

IEnumerator IEnumerable.GetEnumerator()
Returns
TypeDescription
IEnumerator