Class SpannerDbType
Represents a Type that can be stored in a Spanner column or returned from a query.
Inherited Members
Namespace: Google.Cloud.Spanner.Data
Assembly: Google.Cloud.Spanner.Data.dll
Syntax
public sealed class SpannerDbType
Properties
Bool
true
or false
.
Declaration
public static SpannerDbType Bool { get; }
Property Value
Type | Description |
---|---|
SpannerDbType |
Bytes
A byte array (byte[]).
Declaration
public static SpannerDbType Bytes { get; }
Property Value
Type | Description |
---|---|
SpannerDbType |
Date
A Date.
Declaration
public static SpannerDbType Date { get; }
Property Value
Type | Description |
---|---|
SpannerDbType |
DbType
The corresponding DbType for this Cloud Spanner type.
Declaration
public DbType DbType { get; }
Property Value
Type | Description |
---|---|
DbType |
DefaultClrType
The default Type for this Cloud Spanner type.
Declaration
public Type DefaultClrType { get; }
Property Value
Type | Description |
---|---|
Type |
Float32
32 bit floating point number.
Declaration
public static SpannerDbType Float32 { get; }
Property Value
Type | Description |
---|---|
SpannerDbType |
Float64
64 bit floating point number. This is equivalent to Float8 in the PostgreSQL dialect.
Declaration
public static SpannerDbType Float64 { get; }
Property Value
Type | Description |
---|---|
SpannerDbType |
Int64
64 bit signed integer.
Declaration
public static SpannerDbType Int64 { get; }
Property Value
Type | Description |
---|---|
SpannerDbType |
Json
A JSON-formatted string as described in RFC 7159.
Declaration
public static SpannerDbType Json { get; }
Property Value
Type | Description |
---|---|
SpannerDbType |
Numeric
A fixed-point number with 29 decimal digits of precision in the whole component and 9 decimal digits of precision in the fractional component.
Declaration
public static SpannerDbType Numeric { get; }
Property Value
Type | Description |
---|---|
SpannerDbType |
PgJsonb
Representation of PostgreSQL JSONB type.
Declaration
public static SpannerDbType PgJsonb { get; }
Property Value
Type | Description |
---|---|
SpannerDbType |
PgNumeric
Representation of PostgreSQL numeric type. The PostgreSQL numeric type has max precision of 147,455 and a max scale of 16383.
Declaration
public static SpannerDbType PgNumeric { get; }
Property Value
Type | Description |
---|---|
SpannerDbType |
PgOid
Representation of PostgreSQL OID type.
Declaration
public static SpannerDbType PgOid { get; }
Property Value
Type | Description |
---|---|
SpannerDbType |
Size
The size of the Type, if set.
Declaration
public int? Size { get; }
Property Value
Type | Description |
---|---|
int? |
String
A string.
Declaration
public static SpannerDbType String { get; }
Property Value
Type | Description |
---|---|
SpannerDbType |
Timestamp
Date and Time.
Declaration
public static SpannerDbType Timestamp { get; }
Property Value
Type | Description |
---|---|
SpannerDbType |
Unspecified
Not specified.
Declaration
public static SpannerDbType Unspecified { get; }
Property Value
Type | Description |
---|---|
SpannerDbType |
Methods
ArrayOf(SpannerDbType)
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.
Declaration
public static SpannerDbType ArrayOf(SpannerDbType elementType)
Parameters
Type | Name | Description |
---|---|---|
SpannerDbType | elementType | The type of each item in the array. |
Returns
Type | Description |
---|---|
SpannerDbType |
FromClrType(Type)
Returns a SpannerDbType given a ClrType. If the type cannot be determined, Unspecified is returned.
Declaration
public static SpannerDbType FromClrType(Type type)
Parameters
Type | Name | Description |
---|---|---|
Type | type | The clrType to convert. |
Returns
Type | Description |
---|---|
SpannerDbType | The best Spanner representation of the given Clr Type. |
GetHashCode()
Serves as the default hash function.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
int | A hash code for the current object. |
Overrides
ToString()
Returns a string that represents the current object.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
string | A string that represents the current object. |
Overrides
TryParse(string, out SpannerDbType)
Given a string representation, returns an instance of SpannerDbType.
Declaration
public static bool TryParse(string spannerType, out SpannerDbType spannerDbType)
Parameters
Type | Name | Description |
---|---|---|
string | spannerType | A string representation of a SpannerDbType. See ToString(). |
SpannerDbType | spannerDbType | If parsing was successful, then an instance of SpannerDbType. Otherwise null. |
Returns
Type | Description |
---|---|
bool | True if the parse was successful. |
WithSize(int)
Returns a clone of this type with the specified size constraint. Only valid on Google.Cloud.Spanner.V1.TypeCode.String and Google.Cloud.Spanner.V1.TypeCode.Bytes
Declaration
public SpannerDbType WithSize(int size)
Parameters
Type | Name | Description |
---|---|---|
int | size | Represents the number of characters (for Google.Cloud.Spanner.V1.TypeCode.String) or bytes (for Google.Cloud.Spanner.V1.TypeCode.Bytes) |
Returns
Type | Description |
---|---|
SpannerDbType | A new instance of SpannerDbType with the same TypeCode and new size. |