Kinetica   C#   API  Version 7.2.3.1
Type Class Reference

Immutable collection of metadata about a Kinetica type. More...

Public Member Functions

 Type (string label, IEnumerable< Column > columns)
 Creates a Type from column definitions. More...
 
ColumnGetColumn (int index)
 Gets a column by index. More...
 
ColumnGetColumnByName (string name)
 Gets a column by name. More...
 
int? GetColumnIndex (string name)
 Gets a column index by name. More...
 
int GetColumnIndexOrThrow (string name)
 Gets a column index by name, throwing if not found. More...
 
GenericRecord NewInstance ()
 Creates a new GenericRecord instance of this type. More...
 
override string ToString ()
 

Static Public Member Functions

static TypeBuilder Builder (string label)
 Creates a TypeBuilder for fluent construction. More...
 
static async Task< TypeFromTableAsync (kinetica.Kinetica kinetica, string tableName)
 Fetch type from an existing Kinetica table. More...
 
static Type FromTable (kinetica.Kinetica kinetica, string tableName)
 Fetch type from an existing Kinetica table (synchronous version). More...
 
static Type FromShowTableResponse (string tableName, kinetica.ShowTableResponse response)
 Build Type from ShowTableResponse. More...
 

Public Attributes

string Label => _label
 Gets the type label/name. More...
 
string SchemaString => _schemaString
 Gets the Avro schema string. More...
 
string? TypeId => _typeId
 Gets the type ID (if fetched from Kinetica). More...
 
int ColumnCount => _columns.Count
 Gets the number of columns. More...
 
IReadOnlyList< int > ShardKeyIndices => _shardKeyIndices
 Gets the shard key column indices. More...
 
IReadOnlyList< int > PrimaryKeyIndices => _primaryKeyIndices
 Gets the primary key column indices. More...
 
bool HasShardKey => _shardKeyIndices.Count > 0
 Returns true if this type has a shard key. More...
 
bool HasPrimaryKey => _primaryKeyIndices.Count > 0
 Returns true if this type has a primary key. More...
 
IReadOnlyList< ColumnColumns => _columns
 Gets all columns. More...
 

Detailed Description

Immutable collection of metadata about a Kinetica type.

Equivalent to Rust's Type struct.

This class contains all the information needed to create and encode records of this type, including schema information, column metadata, and key indices.

// From existing table
var recordType = await Type.FromTableAsync(kinetica, "my_table");
// Or create programmatically
var recordType = Type.Builder("my_record")
.AddStringColumn("name")
.Build();
// Create records
var record = recordType.NewInstance();
record.Put(0, 42);
record.Put("name", "Alice");

Definition at line 36 of file Type.cs.

Constructor & Destructor Documentation

◆ Type()

Type.Type ( string  label,
IEnumerable< Column columns 
)
inline

Creates a Type from column definitions.

Parameters
labelThe type label/name.
columnsThe column definitions.
Exceptions
ArgumentNullExceptionIf label or columns is null.
ArgumentExceptionIf columns is empty or contains duplicates.

Definition at line 53 of file Type.cs.

Member Function Documentation

◆ Builder()

static TypeBuilder Type.Builder ( string  label)
static

Creates a TypeBuilder for fluent construction.

Equivalent to Rust's Type::builder().

Parameters
labelThe type label/name.
Returns
A new TypeBuilder instance.

◆ FromShowTableResponse()

static Type Type.FromShowTableResponse ( string  tableName,
kinetica.ShowTableResponse  response 
)
inlinestatic

Build Type from ShowTableResponse.

Equivalent to Rust's Type::from_table_response().

Definition at line 168 of file Type.cs.

◆ FromTable()

static Type Type.FromTable ( kinetica.Kinetica  kinetica,
string  tableName 
)
inlinestatic

Fetch type from an existing Kinetica table (synchronous version).

Parameters
kineticaThe Kinetica connection.
tableNameThe table name.
Returns
A Type representing the table schema.

Definition at line 149 of file Type.cs.

◆ FromTableAsync()

static async Task<Type> Type.FromTableAsync ( kinetica.Kinetica  kinetica,
string  tableName 
)
inlinestatic

Fetch type from an existing Kinetica table.

Equivalent to Rust's Type::from_table().

Parameters
kineticaThe Kinetica connection.
tableNameThe table name.
Returns
A Type representing the table schema.

Definition at line 128 of file Type.cs.

◆ GetColumn()

Column? Type.GetColumn ( int  index)
inline

Gets a column by index.

Parameters
indexThe column index.
Returns
The column, or null if index is out of range.

Definition at line 312 of file Type.cs.

◆ GetColumnByName()

Column? Type.GetColumnByName ( string  name)
inline

Gets a column by name.

Parameters
nameThe column name (case-insensitive).
Returns
The column, or null if not found.

Definition at line 324 of file Type.cs.

◆ GetColumnIndex()

int? Type.GetColumnIndex ( string  name)
inline

Gets a column index by name.

Parameters
nameThe column name (case-insensitive).
Returns
The column index, or null if not found.

Definition at line 336 of file Type.cs.

◆ GetColumnIndexOrThrow()

int Type.GetColumnIndexOrThrow ( string  name)
inline

Gets a column index by name, throwing if not found.

Parameters
nameThe column name (case-insensitive).
Returns
The column index.
Exceptions
KeyNotFoundExceptionIf the column is not found.

Definition at line 349 of file Type.cs.

◆ NewInstance()

GenericRecord Type.NewInstance ( )

Creates a new GenericRecord instance of this type.

Equivalent to Rust's Type::new_instance().

Returns
A new GenericRecord with all values initialized to null.

◆ ToString()

override string Type.ToString ( )
inline

Definition at line 433 of file Type.cs.

Member Data Documentation

◆ ColumnCount

int Type.ColumnCount => _columns.Count

Gets the number of columns.

Definition at line 286 of file Type.cs.

◆ Columns

IReadOnlyList<Column> Type.Columns => _columns

Gets all columns.

Definition at line 301 of file Type.cs.

◆ HasPrimaryKey

bool Type.HasPrimaryKey => _primaryKeyIndices.Count > 0

Returns true if this type has a primary key.

Definition at line 298 of file Type.cs.

◆ HasShardKey

bool Type.HasShardKey => _shardKeyIndices.Count > 0

Returns true if this type has a shard key.

Definition at line 295 of file Type.cs.

◆ Label

string Type.Label => _label

Gets the type label/name.

Definition at line 277 of file Type.cs.

◆ PrimaryKeyIndices

IReadOnlyList<int> Type.PrimaryKeyIndices => _primaryKeyIndices

Gets the primary key column indices.

Definition at line 292 of file Type.cs.

◆ SchemaString

string Type.SchemaString => _schemaString

Gets the Avro schema string.

Definition at line 280 of file Type.cs.

◆ ShardKeyIndices

IReadOnlyList<int> Type.ShardKeyIndices => _shardKeyIndices

Gets the shard key column indices.

Definition at line 289 of file Type.cs.

◆ TypeId

string? Type.TypeId => _typeId

Gets the type ID (if fetched from Kinetica).

Definition at line 283 of file Type.cs.


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