Kinetica   C#   API  Version 7.2.3.1
GenericRecord Class Reference

A generic record that can hold values for any Kinetica type. More...

+ Inheritance diagram for GenericRecord:
+ Collaboration diagram for GenericRecord:

Public Member Functions

 GenericRecord (Type type)
 Creates a new GenericRecord for the given type. More...
 
bool Put (int index, int value)
 Sets an integer value by column index. More...
 
bool Put (int index, long value)
 Sets a long value by column index. More...
 
bool Put (int index, float value)
 Sets a float value by column index. More...
 
bool Put (int index, double value)
 Sets a double value by column index. More...
 
bool Put (int index, string? value)
 Sets a string value by column index. More...
 
bool Put (int index, byte[]? value)
 Sets a bytes value by column index. More...
 
bool Put (int index, bool value)
 Sets a boolean value by column index. More...
 
bool PutNull (int index)
 Sets a null value by column index. More...
 
bool Put (int index, RecordValue value)
 Sets a RecordValue by column index. More...
 
bool Put (string name, int value)
 Sets an integer value by column name. More...
 
bool Put (string name, long value)
 Sets a long value by column name. More...
 
bool Put (string name, float value)
 Sets a float value by column name. More...
 
bool Put (string name, double value)
 Sets a double value by column name. More...
 
bool Put (string name, string? value)
 Sets a string value by column name. More...
 
bool Put (string name, byte[]? value)
 Sets a bytes value by column name. More...
 
bool Put (string name, bool value)
 Sets a boolean value by column name. More...
 
bool PutNull (string name)
 Sets a null value by column name. More...
 
bool Put (string name, RecordValue value)
 Sets a RecordValue by column name. More...
 
RecordValueGet (int index)
 Gets the raw RecordValue at the specified index. More...
 
int? GetInt (int index)
 Gets an integer value by column index. More...
 
long? GetLong (int index)
 Gets a long value by column index. More...
 
float? GetFloat (int index)
 Gets a float value by column index. More...
 
double? GetDouble (int index)
 Gets a double value by column index. More...
 
string? GetString (int index)
 Gets a string value by column index. More...
 
byte? [] GetBytes (int index)
 Gets a bytes value by column index. More...
 
bool? GetBool (int index)
 Gets a boolean value by column index. More...
 
RecordValueGet (string name)
 Gets the raw RecordValue by column name. More...
 
int? GetInt (string name)
 Gets an integer value by column name. More...
 
long? GetLong (string name)
 Gets a long value by column name. More...
 
float? GetFloat (string name)
 Gets a float value by column name. More...
 
double? GetDouble (string name)
 Gets a double value by column name. More...
 
string? GetString (string name)
 Gets a string value by column name. More...
 
byte? [] GetBytes (string name)
 Gets a bytes value by column name. More...
 
bool? GetBool (string name)
 Gets a boolean value by column name. More...
 
string GetAvroSchema ()
 Returns the Avro schema as a JSON string for this record type. More...
 
ShardKeyValues GetShardKeyValues ()
 Returns shard key column names and their typed values. More...
 
GenericRecord Clone ()
 Creates a copy of this record. More...
 
void Clear ()
 Resets all values to null. More...
 
object? [] ToObjectArray ()
 Gets all values as objects (for Avro serialization). More...
 
override string ToString ()
 

Static Public Member Functions

static IReadOnlyDictionary< string, IList< string > > GetTypeProperties (Type type)
 Returns type properties for this record type. More...
 

Public Attributes

Type RecordType => _type
 Gets the Type definition for this record. More...
 

Detailed Description

A generic record that can hold values for any Kinetica type.

Equivalent to Rust's GenericRecord struct.

This class stores values in an array indexed by column position, and uses the associated Type for schema information. It implements both IKineticaRecord and IShardKeyExtractor for use with BulkInserter.

var recordType = await Type.FromTableAsync(kinetica, "my_table");
var record = recordType.NewInstance();
// Set values by index
record.Put(0, 42);
record.Put(1, "Alice");
// Set values by name
record.Put("score", 95.5);
// Get values
int? id = record.GetInt(0);
string? name = record.GetString("name");

Definition at line 35 of file GenericRecord.cs.

Constructor & Destructor Documentation

◆ GenericRecord()

GenericRecord.GenericRecord ( Type  type)
inline

Creates a new GenericRecord for the given type.

All values are initialized to Null.

Parameters
typeThe Type definition for this record.

Definition at line 45 of file GenericRecord.cs.

Member Function Documentation

◆ Clear()

void GenericRecord.Clear ( )
inline

Resets all values to null.

Definition at line 431 of file GenericRecord.cs.

◆ Clone()

GenericRecord GenericRecord.Clone ( )
inline

Creates a copy of this record.

Definition at line 421 of file GenericRecord.cs.

◆ Get() [1/2]

RecordValue? GenericRecord.Get ( int  index)
inline

Gets the raw RecordValue at the specified index.

Definition at line 204 of file GenericRecord.cs.

◆ Get() [2/2]

RecordValue? GenericRecord.Get ( string  name)
inline

Gets the raw RecordValue by column name.

Definition at line 264 of file GenericRecord.cs.

◆ GetAvroSchema()

string GenericRecord.GetAvroSchema ( )

Returns the Avro schema as a JSON string for this record type.

Implements IKineticaRecord.

◆ GetBool() [1/2]

bool? GenericRecord.GetBool ( int  index)
inline

Gets a boolean value by column index.

Definition at line 253 of file GenericRecord.cs.

◆ GetBool() [2/2]

bool? GenericRecord.GetBool ( string  name)
inline

Gets a boolean value by column name.

Definition at line 313 of file GenericRecord.cs.

◆ GetBytes() [1/2]

byte? [] GenericRecord.GetBytes ( int  index)
inline

Gets a bytes value by column index.

Definition at line 246 of file GenericRecord.cs.

◆ GetBytes() [2/2]

byte? [] GenericRecord.GetBytes ( string  name)
inline

Gets a bytes value by column name.

Definition at line 306 of file GenericRecord.cs.

◆ GetDouble() [1/2]

double? GenericRecord.GetDouble ( int  index)
inline

Gets a double value by column index.

Definition at line 232 of file GenericRecord.cs.

◆ GetDouble() [2/2]

double? GenericRecord.GetDouble ( string  name)
inline

Gets a double value by column name.

Definition at line 292 of file GenericRecord.cs.

◆ GetFloat() [1/2]

float? GenericRecord.GetFloat ( int  index)
inline

Gets a float value by column index.

Definition at line 225 of file GenericRecord.cs.

◆ GetFloat() [2/2]

float? GenericRecord.GetFloat ( string  name)
inline

Gets a float value by column name.

Definition at line 285 of file GenericRecord.cs.

◆ GetInt() [1/2]

int? GenericRecord.GetInt ( int  index)
inline

Gets an integer value by column index.

Definition at line 211 of file GenericRecord.cs.

◆ GetInt() [2/2]

int? GenericRecord.GetInt ( string  name)
inline

Gets an integer value by column name.

Definition at line 271 of file GenericRecord.cs.

◆ GetLong() [1/2]

long? GenericRecord.GetLong ( int  index)
inline

Gets a long value by column index.

Definition at line 218 of file GenericRecord.cs.

◆ GetLong() [2/2]

long? GenericRecord.GetLong ( string  name)
inline

Gets a long value by column name.

Definition at line 278 of file GenericRecord.cs.

◆ GetShardKeyValues()

ShardKeyValues GenericRecord.GetShardKeyValues ( )
inline

Returns shard key column names and their typed values.

Implements IShardKeyExtractor.

Definition at line 349 of file GenericRecord.cs.

◆ GetString() [1/2]

string? GenericRecord.GetString ( int  index)
inline

Gets a string value by column index.

Definition at line 239 of file GenericRecord.cs.

◆ GetString() [2/2]

string? GenericRecord.GetString ( string  name)
inline

Gets a string value by column name.

Definition at line 299 of file GenericRecord.cs.

◆ GetTypeProperties()

static IReadOnlyDictionary<string, IList<string> > GenericRecord.GetTypeProperties ( Type  type)
inlinestatic

Returns type properties for this record type.

Definition at line 331 of file GenericRecord.cs.

◆ Put() [1/16]

bool GenericRecord.Put ( int  index,
int  value 
)
inline

Sets an integer value by column index.

Definition at line 61 of file GenericRecord.cs.

◆ Put() [2/16]

bool GenericRecord.Put ( int  index,
long  value 
)
inline

Sets a long value by column index.

Definition at line 69 of file GenericRecord.cs.

◆ Put() [3/16]

bool GenericRecord.Put ( int  index,
float  value 
)
inline

Sets a float value by column index.

Definition at line 77 of file GenericRecord.cs.

◆ Put() [4/16]

bool GenericRecord.Put ( int  index,
double  value 
)
inline

Sets a double value by column index.

Definition at line 85 of file GenericRecord.cs.

◆ Put() [5/16]

bool GenericRecord.Put ( int  index,
string?  value 
)
inline

Sets a string value by column index.

Definition at line 93 of file GenericRecord.cs.

◆ Put() [6/16]

bool GenericRecord.Put ( int  index,
byte? []  value 
)
inline

Sets a bytes value by column index.

Definition at line 101 of file GenericRecord.cs.

◆ Put() [7/16]

bool GenericRecord.Put ( int  index,
bool  value 
)
inline

Sets a boolean value by column index.

Definition at line 109 of file GenericRecord.cs.

◆ Put() [8/16]

bool GenericRecord.Put ( int  index,
RecordValue  value 
)
inline

Sets a RecordValue by column index.

Definition at line 125 of file GenericRecord.cs.

◆ Put() [9/16]

bool GenericRecord.Put ( string  name,
int  value 
)
inline

Sets an integer value by column name.

Definition at line 137 of file GenericRecord.cs.

◆ Put() [10/16]

bool GenericRecord.Put ( string  name,
long  value 
)
inline

Sets a long value by column name.

Definition at line 144 of file GenericRecord.cs.

◆ Put() [11/16]

bool GenericRecord.Put ( string  name,
float  value 
)
inline

Sets a float value by column name.

Definition at line 151 of file GenericRecord.cs.

◆ Put() [12/16]

bool GenericRecord.Put ( string  name,
double  value 
)
inline

Sets a double value by column name.

Definition at line 158 of file GenericRecord.cs.

◆ Put() [13/16]

bool GenericRecord.Put ( string  name,
string?  value 
)
inline

Sets a string value by column name.

Definition at line 165 of file GenericRecord.cs.

◆ Put() [14/16]

bool GenericRecord.Put ( string  name,
byte? []  value 
)
inline

Sets a bytes value by column name.

Definition at line 172 of file GenericRecord.cs.

◆ Put() [15/16]

bool GenericRecord.Put ( string  name,
bool  value 
)
inline

Sets a boolean value by column name.

Definition at line 179 of file GenericRecord.cs.

◆ Put() [16/16]

bool GenericRecord.Put ( string  name,
RecordValue  value 
)
inline

Sets a RecordValue by column name.

Definition at line 193 of file GenericRecord.cs.

◆ PutNull() [1/2]

bool GenericRecord.PutNull ( int  index)
inline

Sets a null value by column index.

Definition at line 117 of file GenericRecord.cs.

◆ PutNull() [2/2]

bool GenericRecord.PutNull ( string  name)
inline

Sets a null value by column name.

Definition at line 186 of file GenericRecord.cs.

◆ ToObjectArray()

object? [] GenericRecord.ToObjectArray ( )
inline

Gets all values as objects (for Avro serialization).

Definition at line 445 of file GenericRecord.cs.

◆ ToString()

override string GenericRecord.ToString ( )
inline

Definition at line 468 of file GenericRecord.cs.

Member Data Documentation

◆ RecordType

Type GenericRecord.RecordType => _type

Gets the Type definition for this record.

Definition at line 56 of file GenericRecord.cs.


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