public sealed class SpannerStruct : IReadOnlyList<SpannerStruct.Field>, IReadOnlyCollection<SpannerStruct.Field>, IEnumerable<SpannerStruct.Field>, IEnumerable
A struct parameter or returned value.
Implements
IReadOnlyList<SpannerStruct.Field>, IReadOnlyCollection<SpannerStruct.Field>, IEnumerable<SpannerStruct.Field>, IEnumerableNamespace
Google.Cloud.Spanner.DataAssembly
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 | |
---|---|
Type | Description |
Int32 |
Item[Int32]
public SpannerStruct.Field this[int index] { get; }
Returns the field at the given index.
Parameter | |
---|---|
Name | Description |
index | Int32 The index of the field to return |
Property Value | |
---|---|
Type | Description |
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 | |
---|---|
Name | Description |
field | SpannerStruct.Field The field to add. Must not be null. |
Returns | |
---|---|
Type | Description |
SpannerStruct.Field |
|
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 | |
---|---|
Name | Description |
name | String 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. |
type | SpannerDbType The type of the field. Must not be null. |
value | Object The value of the field. May be null. |
Returns | |
---|---|
Type | Description |
SpannerStruct.Field | The newly-added field. |
GetEnumerator()
public IEnumerator<SpannerStruct.Field> GetEnumerator()
Returns | |
---|---|
Type | Description |
IEnumerator<SpannerStruct.Field> |
GetSpannerDbType()
public SpannerDbType GetSpannerDbType()
Returns the full schema of this struct as a SpannerDbType.
Returns | |
---|---|
Type | Description |
SpannerDbType | The SpannerDbType representing the schema of this struct. |
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 | |
---|---|
Type | Description |
IEnumerator |