Kinetica   C#   API  Version 7.2.3.1
ShardKeyValue Struct Reference

A typed value for shard key computation. More...

Inherits IEquatable< ShardKeyValue >.

Public Member Functions

int AsInt ()
 Gets the value as a 32-bit integer. More...
 
long AsLong ()
 Gets the value as a 64-bit integer. More...
 
float AsFloat ()
 Gets the value as a 32-bit float. More...
 
double AsDouble ()
 Gets the value as a 64-bit double. More...
 
string? AsString ()
 Gets the value as a string. More...
 
bool AsBool ()
 Gets the value as a boolean. More...
 
bool TryGetInt (out int value)
 Tries to get the value as an integer. More...
 
bool TryGetLong (out long value)
 Tries to get the value as a long. More...
 
bool TryGetString (out string? value)
 Tries to get the value as a string. More...
 
bool Equals (ShardKeyValue other)
 
override bool Equals (object? obj)
 
override int GetHashCode ()
 
override string ToString ()
 

Static Public Member Functions

static ShardKeyValue Null ()
 Creates a null shard key value. More...
 
static ShardKeyValue Int (int value)
 Creates a 32-bit integer shard key value. More...
 
static ShardKeyValue Long (long value)
 Creates a 64-bit integer shard key value. More...
 
static ShardKeyValue Float (float value)
 Creates a 32-bit float shard key value. More...
 
static ShardKeyValue Double (double value)
 Creates a 64-bit double shard key value. More...
 
static ShardKeyValue String (string value)
 Creates a string shard key value. More...
 
static ShardKeyValue Date (string value)
 Creates a date shard key value (YYYY-MM-DD format). More...
 
static ShardKeyValue DateTime (string value)
 Creates a datetime shard key value (YYYY-MM-DD HH:MM:SS.mmm format). More...
 
static ShardKeyValue Time (string value)
 Creates a time shard key value (HH:MM:SS.mmm format). More...
 
static ShardKeyValue Ipv4 (string value)
 Creates an IPv4 shard key value (dotted-quad format). More...
 
static ShardKeyValue Decimal (string value)
 Creates a decimal shard key value (string representation). More...
 
static ShardKeyValue Boolean (bool value)
 Creates a boolean shard key value. More...
 
static ShardKeyValue Int8 (sbyte value)
 Creates an 8-bit integer shard key value. More...
 
static ShardKeyValue Int16 (short value)
 Creates a 16-bit integer shard key value. More...
 
static ShardKeyValue Timestamp (long value)
 Creates a timestamp shard key value (milliseconds since Unix epoch). More...
 
static ShardKeyValue Uuid (string value)
 Creates a UUID shard key value (standard format). More...
 
static ShardKeyValue Ulong (string value)
 Creates an unsigned long shard key value (string representation). More...
 
static bool operator== (ShardKeyValue left, ShardKeyValue right)
 
static bool operator != (ShardKeyValue left, ShardKeyValue right)
 

Public Attributes

ShardKeyValueType Type => _type
 Gets the type of this shard key value. More...
 
bool IsNull => _type == ShardKeyValueType.Null
 Returns true if this value is null. More...
 

Detailed Description

A typed value for shard key computation.

Equivalent to Rust's ShardKeyValue enum.

This struct provides type-safe storage for shard key values without requiring boxing or string parsing at routing time.

Definition at line 57 of file ShardKeyValue.cs.

Member Function Documentation

◆ AsBool()

bool ShardKeyValue.AsBool ( )
inline

Gets the value as a boolean.

Exceptions
InvalidOperationExceptionIf the value type is not Boolean.

Definition at line 205 of file ShardKeyValue.cs.

◆ AsDouble()

double ShardKeyValue.AsDouble ( )
inline

Gets the value as a 64-bit double.

Exceptions
InvalidOperationExceptionIf the value type is not Double or Float.

Definition at line 177 of file ShardKeyValue.cs.

◆ AsFloat()

float ShardKeyValue.AsFloat ( )
inline

Gets the value as a 32-bit float.

Exceptions
InvalidOperationExceptionIf the value type is not Float.

Definition at line 165 of file ShardKeyValue.cs.

◆ AsInt()

int ShardKeyValue.AsInt ( )
inline

Gets the value as a 32-bit integer.

Exceptions
InvalidOperationExceptionIf the value type is not Int, Int8, Int16, or Boolean.

Definition at line 138 of file ShardKeyValue.cs.

◆ AsLong()

long ShardKeyValue.AsLong ( )
inline

Gets the value as a 64-bit integer.

Exceptions
InvalidOperationExceptionIf the value type is not numeric.

Definition at line 151 of file ShardKeyValue.cs.

◆ AsString()

string? ShardKeyValue.AsString ( )
inline

Gets the value as a string.

Exceptions
InvalidOperationExceptionIf the value type is not a string-based type.

Definition at line 189 of file ShardKeyValue.cs.

◆ Boolean()

static ShardKeyValue ShardKeyValue.Boolean ( bool  value)
static

Creates a boolean shard key value.

◆ Date()

static ShardKeyValue ShardKeyValue.Date ( string  value)
static

Creates a date shard key value (YYYY-MM-DD format).

◆ DateTime()

static ShardKeyValue ShardKeyValue.DateTime ( string  value)
static

Creates a datetime shard key value (YYYY-MM-DD HH:MM:SS.mmm format).

◆ Decimal()

static ShardKeyValue ShardKeyValue.Decimal ( string  value)
static

Creates a decimal shard key value (string representation).

◆ Double()

static ShardKeyValue ShardKeyValue.Double ( double  value)
static

Creates a 64-bit double shard key value.

◆ Equals() [1/2]

bool ShardKeyValue.Equals ( ShardKeyValue  other)
inline

Definition at line 257 of file ShardKeyValue.cs.

◆ Equals() [2/2]

override bool ShardKeyValue.Equals ( object?  obj)

◆ Float()

static ShardKeyValue ShardKeyValue.Float ( float  value)
static

Creates a 32-bit float shard key value.

◆ GetHashCode()

override int ShardKeyValue.GetHashCode ( )
inline

Definition at line 275 of file ShardKeyValue.cs.

◆ Int()

static ShardKeyValue ShardKeyValue.Int ( int  value)
static

Creates a 32-bit integer shard key value.

◆ Int16()

static ShardKeyValue ShardKeyValue.Int16 ( short  value)
static

Creates a 16-bit integer shard key value.

◆ Int8()

static ShardKeyValue ShardKeyValue.Int8 ( sbyte  value)
static

Creates an 8-bit integer shard key value.

◆ Ipv4()

static ShardKeyValue ShardKeyValue.Ipv4 ( string  value)
static

Creates an IPv4 shard key value (dotted-quad format).

◆ Long()

static ShardKeyValue ShardKeyValue.Long ( long  value)
static

Creates a 64-bit integer shard key value.

◆ Null()

static ShardKeyValue ShardKeyValue.Null ( )
static

Creates a null shard key value.

◆ operator !=()

static bool ShardKeyValue.operator != ( ShardKeyValue  left,
ShardKeyValue  right 
)
static

◆ operator==()

static bool ShardKeyValue.operator== ( ShardKeyValue  left,
ShardKeyValue  right 
)
static

◆ String()

static ShardKeyValue ShardKeyValue.String ( string  value)
static

Creates a string shard key value.

◆ Time()

static ShardKeyValue ShardKeyValue.Time ( string  value)
static

Creates a time shard key value (HH:MM:SS.mmm format).

◆ Timestamp()

static ShardKeyValue ShardKeyValue.Timestamp ( long  value)
static

Creates a timestamp shard key value (milliseconds since Unix epoch).

◆ ToString()

override string ShardKeyValue.ToString ( )
inline

Definition at line 294 of file ShardKeyValue.cs.

◆ TryGetInt()

bool ShardKeyValue.TryGetInt ( out int  value)
inline

Tries to get the value as an integer.

Definition at line 215 of file ShardKeyValue.cs.

◆ TryGetLong()

bool ShardKeyValue.TryGetLong ( out long  value)
inline

Tries to get the value as a long.

Definition at line 227 of file ShardKeyValue.cs.

◆ TryGetString()

bool ShardKeyValue.TryGetString ( out string?  value)
inline

Tries to get the value as a string.

Definition at line 240 of file ShardKeyValue.cs.

◆ Ulong()

static ShardKeyValue ShardKeyValue.Ulong ( string  value)
static

Creates an unsigned long shard key value (string representation).

◆ Uuid()

static ShardKeyValue ShardKeyValue.Uuid ( string  value)
static

Creates a UUID shard key value (standard format).

Member Data Documentation

◆ IsNull

bool ShardKeyValue.IsNull => _type == ShardKeyValueType.Null

Returns true if this value is null.

Definition at line 76 of file ShardKeyValue.cs.

◆ Type

ShardKeyValueType ShardKeyValue.Type => _type

Gets the type of this shard key value.

Definition at line 73 of file ShardKeyValue.cs.


The documentation for this struct was generated from the following file: