Class SpannerDbType (3.12.0)

public sealed class SpannerDbType

Represents a Type that can be stored in a Spanner column or returned from a query.

Inheritance

Object > SpannerDbType

Namespace

Google.Cloud.Spanner.Data

Assembly

Google.Cloud.Spanner.Data.dll

Properties

Bool

public static SpannerDbType Bool { get; }

true or false.

Property Value
TypeDescription
SpannerDbType

Bytes

public static SpannerDbType Bytes { get; }

A byte array (byte[]).

Property Value
TypeDescription
SpannerDbType

Date

public static SpannerDbType Date { get; }

A Date.

Property Value
TypeDescription
SpannerDbType

DbType

public DbType DbType { get; }

The corresponding DbType for this Cloud Spanner type.

Property Value
TypeDescription
DbType

DefaultClrType

public Type DefaultClrType { get; }

The default Type for this Cloud Spanner type.

Property Value
TypeDescription
Type

Float64

public static SpannerDbType Float64 { get; }

64 bit floating point number.

Property Value
TypeDescription
SpannerDbType

Int64

public static SpannerDbType Int64 { get; }

64 bit signed integer.

Property Value
TypeDescription
SpannerDbType

Json

public static SpannerDbType Json { get; }

A JSON-formatted string as described in RFC 7159.

Property Value
TypeDescription
SpannerDbType

Numeric

public static SpannerDbType Numeric { get; }

A fixed-point number with 29 decimal digits of precision in the whole component and 9 decimal digits of precision in the fractional component.

Property Value
TypeDescription
SpannerDbType

Size

public int? Size { get; }

The size of the Type, if set.

Property Value
TypeDescription
Nullable<Int32>

String

public static SpannerDbType String { get; }

A string.

Property Value
TypeDescription
SpannerDbType

Timestamp

public static SpannerDbType Timestamp { get; }

Date and Time.

Property Value
TypeDescription
SpannerDbType

Unspecified

public static SpannerDbType Unspecified { get; }

Not specified.

Property Value
TypeDescription
SpannerDbType

Methods

ArrayOf(SpannerDbType)

public static SpannerDbType ArrayOf(SpannerDbType elementType)

Creates an array of the specified type. This can be done on any arbitrary SpannerDbType. You may use any type that implements IEnumerable as a source for the array. The type of each item is determined by elementType. When calling GetFieldValue<T>(String) the default type is List<T>. You may, however, specify any type that implements IList which has a default constructor.

Parameter
NameDescription
elementTypeSpannerDbType

The type of each item in the array.

Returns
TypeDescription
SpannerDbType

FromClrType(Type)

public static SpannerDbType FromClrType(Type type)

Returns a SpannerDbType given a ClrType. If the type cannot be determined, Unspecified is returned.

Parameter
NameDescription
typeType

The clrType to convert.

Returns
TypeDescription
SpannerDbType

The best Spanner representation of the given Clr Type.

GetHashCode()

public override int GetHashCode()
Returns
TypeDescription
Int32
Overrides

ToString()

public override string ToString()
Returns
TypeDescription
String
Overrides

TryParse(String, out SpannerDbType)

public static bool TryParse(string spannerType, out SpannerDbType spannerDbType)

Given a string representation, returns an instance of SpannerDbType.

Parameters
NameDescription
spannerTypeString

A string representation of a SpannerDbType. See ToString().

spannerDbTypeSpannerDbType

If parsing was successful, then an instance of SpannerDbType. Otherwise null.

Returns
TypeDescription
Boolean

True if the parse was successful.

WithSize(Int32)

public SpannerDbType WithSize(int size)

Returns a clone of this type with the specified size constraint. Only valid on String and Bytes

Parameter
NameDescription
sizeInt32

Represents the number of characters (for String) or bytes (for Bytes)

Returns
TypeDescription
SpannerDbType

A new instance of SpannerDbType with the same Google.Cloud.Spanner.Data.SpannerDbType.TypeCode and new size.